diff --git a/package.json b/package.json index 7e2d1d8..2531533 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "id": "firecoder.chat-gui", "name": "", "visibility": "visible", - "when": "config.firecoder.experimental.chat" + "when": "config.firecoder.experimental.chat || config.firecoder.cloud.use" } ] }, diff --git a/src/common/server/index.ts b/src/common/server/index.ts index 9438e87..6ef2fd3 100644 --- a/src/common/server/index.ts +++ b/src/common/server/index.ts @@ -127,6 +127,7 @@ class Server { ...(useGPU ? ["--n-gpu-layers", "100"] : []), "--cont-batching", "--embedding", + "--slots-endpoint-disable", "--log-disable", ], { @@ -143,7 +144,9 @@ class Server { msgString.includes('"path":"/health"') || msgString.includes('"path":"/tokenize"') || msgString.includes("/model.json") || - msgString.includes("sampled token:") + msgString.includes("process_single_task") || + msgString.includes("sampled token:") || + msgString.includes("update_slots") ) { return; } @@ -159,7 +162,9 @@ class Server { msgString.includes('"path":"/health"') || msgString.includes('"path":"/tokenize"') || msgString.includes("/model.json") || - msgString.includes("sampled token:") + msgString.includes("process_single_task") || + msgString.includes("sampled token:") || + msgString.includes("update_slots") ) { return; } diff --git a/src/common/utils/configuration.ts b/src/common/utils/configuration.ts index 1c7d087..0bce5f9 100644 --- a/src/common/utils/configuration.ts +++ b/src/common/utils/configuration.ts @@ -89,6 +89,8 @@ class Configuration { public get( property: T ): ConfigurationPropertiesType[T]["possibleValues"] { + this.configuration = vscode.workspace.getConfiguration("firecoder"); + return ( this.configuration.get(property) ?? ConfigurationProperties[property]["default"] diff --git a/src/extension.ts b/src/extension.ts index cb3f657..857e42a 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -19,26 +19,17 @@ export async function activate(context: vscode.ExtensionContext) { sendTelemetry: true, }); - if ( - configuration.get("cloud.use") || - configuration.get("experimental.chat") - ) { - const provider = new ChatPanel(context.extensionUri); - context.subscriptions.push( - vscode.window.registerWebviewViewProvider( - "firecoder.chat-gui", - provider, - { - webviewOptions: { retainContextWhenHidden: true }, - } - ) - ); - context.subscriptions.push( - vscode.commands.registerCommand("firecoder.startNewChat", async () => { - await provider.sendMessageToWebview("startNewChat", {}); - }) - ); - } + const provider = new ChatPanel(context.extensionUri); + context.subscriptions.push( + vscode.window.registerWebviewViewProvider("firecoder.chat-gui", provider, { + webviewOptions: { retainContextWhenHidden: true }, + }) + ); + context.subscriptions.push( + vscode.commands.registerCommand("firecoder.startNewChat", async () => { + await provider.sendMessageToWebview("startNewChat", {}); + }) + ); statusBar.init(context); @@ -66,6 +57,38 @@ export async function activate(context: vscode.ExtensionContext) { }) ); + vscode.workspace.onDidChangeConfiguration(async (event) => { + if ( + event.affectsConfiguration("firecoder.cloud.use") || + event.affectsConfiguration("firecoder.experimental.chat") || + event.affectsConfiguration("firecoder.completion.manuallyMode") || + event.affectsConfiguration("firecoder.completion.autoMode") || + event.affectsConfiguration( + "firecoder.experimental.useGpu.linux.nvidia" + ) || + event.affectsConfiguration("firecoder.experimental.useGpu.osx.metal") || + event.affectsConfiguration( + "firecoder.experimental.useGpu.windows.nvidia" + ) || + event.affectsConfiguration("firecoder.server.usePreRelease") + ) { + Object.values(servers).forEach((server) => server.stopServer()); + const serversToStart = [ + ...new Set([ + configuration.get("completion.autoMode"), + configuration.get("completion.manuallyMode"), + ...(configuration.get("experimental.chat") && + !configuration.get("cloud.use") + ? ["chat-medium" as const] + : []), + ]), + ]; + await Promise.all( + serversToStart.map((serverType) => servers[serverType].startServer()) + ); + } + }); + (async () => { if (configuration.get("cloud.use")) { Logger.info("Use cloud for chat", {