"use strict";(self.webpackChunkpergamon_server_extension=self.webpackChunkpergamon_server_extension||[]).push([[509],{509:(e,t,n)=>{n.r(t),n.d(t,{default:()=>i});var o=n(263);const i={id:"pergamon_server_extension:plugin",description:"Calliope server extension",requires:[o.INotebookTracker],autoStart:!0,activate:(e,t)=>{t.widgetAdded.connect(((e,t)=>{t.sessionContext.ready.then((()=>{var e;const n=t.sessionContext.session;(null==n?void 0:n.kernel)&&(n.kernel.registerCommTarget("toggle_fixing",(e=>{e.onMsg=e=>{const n=t.content.activeCell;if(n){const e=n;e.model.sharedModel&&e.node.classList.toggle("calliope-thinking")}}})),n.kernel.registerCommTarget("toggle_thinking",(e=>{e.onMsg=e=>{(t.content.widgets||[]).forEach((e=>{if(e){const t=e;if(!(t&&t.model&&t.model.sharedModel&&t.node))return;const n=(t.model.sharedModel.source||"").trim().startsWith("%%calliope"),o=t.node.classList.contains("calliope-thinking"),i=t.node.classList.contains("executing");n&&(i&&!o?t.node.classList.add("calliope-thinking"):!i&&o&&t.node.classList.remove("calliope-thinking"))}}))}})),null===(e=null==n?void 0:n.kernel)||void 0===e||e.registerCommTarget("replace_cell",(e=>{e.onMsg=e=>{const n=e.content.data.replace_with,i=t.content.activeCell;if(i&&"code"===i.model.type){const e=i;e.editor&&(e.model.sharedModel.setSource(n),o.NotebookActions.run(t.content,t.sessionContext))}}})),n.kernel.requestExecute({code:"\n%load_ext jupyter_ai\n%ai register anthropic-chat anthropic-chat:claude-2.0\n%ai register native-cohere cohere:command\n%ai register bedrock-cohere bedrock:cohere.command-text-v14\n%ai register anthropic anthropic:claude-v1\n%ai register bedrock bedrock:amazon.titan-text-lite-v1\n%ai register gemini gemini:gemini-1.0-pro-001\n%ai register gpto openai-chat:gpt-4o\n%ai delete ernie-bot\n%ai delete ernie-bot-4\n%ai delete titan\n%load_ext pergamon_server_extension\n"}).done.then((()=>{})));const i=t.content;t.context.sessionContext.statusChanged.connect(((e,t)=>{if("busy"===t){const e=i.activeCell;e&&e.node.classList.add("executing")}"idle"===t&&i.widgets.forEach((e=>{e.node.classList.remove("executing"),e.node.classList.remove("calliope-thinking")}))}))}))})),new MutationObserver(((e,t)=>{const n=document.querySelector(".jp-Splash");n&&(n.remove(),t.disconnect())})).observe(document.body,{childList:!0,subtree:!0})}}}}]);