@@ -19,26 +19,17 @@ export async function activate(context: vscode.ExtensionContext) {
1919 sendTelemetry : true ,
2020 } ) ;
2121
22- if (
23- configuration . get ( "cloud.use" ) ||
24- configuration . get ( "experimental.chat" )
25- ) {
26- const provider = new ChatPanel ( context . extensionUri ) ;
27- context . subscriptions . push (
28- vscode . window . registerWebviewViewProvider (
29- "firecoder.chat-gui" ,
30- provider ,
31- {
32- webviewOptions : { retainContextWhenHidden : true } ,
33- }
34- )
35- ) ;
36- context . subscriptions . push (
37- vscode . commands . registerCommand ( "firecoder.startNewChat" , async ( ) => {
38- await provider . sendMessageToWebview ( "startNewChat" , { } ) ;
39- } )
40- ) ;
41- }
22+ const provider = new ChatPanel ( context . extensionUri ) ;
23+ context . subscriptions . push (
24+ vscode . window . registerWebviewViewProvider ( "firecoder.chat-gui" , provider , {
25+ webviewOptions : { retainContextWhenHidden : true } ,
26+ } )
27+ ) ;
28+ context . subscriptions . push (
29+ vscode . commands . registerCommand ( "firecoder.startNewChat" , async ( ) => {
30+ await provider . sendMessageToWebview ( "startNewChat" , { } ) ;
31+ } )
32+ ) ;
4233
4334 statusBar . init ( context ) ;
4435
@@ -66,6 +57,38 @@ export async function activate(context: vscode.ExtensionContext) {
6657 } )
6758 ) ;
6859
60+ vscode . workspace . onDidChangeConfiguration ( async ( event ) => {
61+ if (
62+ event . affectsConfiguration ( "firecoder.cloud.use" ) ||
63+ event . affectsConfiguration ( "firecoder.experimental.chat" ) ||
64+ event . affectsConfiguration ( "firecoder.completion.manuallyMode" ) ||
65+ event . affectsConfiguration ( "firecoder.completion.autoMode" ) ||
66+ event . affectsConfiguration (
67+ "firecoder.experimental.useGpu.linux.nvidia"
68+ ) ||
69+ event . affectsConfiguration ( "firecoder.experimental.useGpu.osx.metal" ) ||
70+ event . affectsConfiguration (
71+ "firecoder.experimental.useGpu.windows.nvidia"
72+ ) ||
73+ event . affectsConfiguration ( "firecoder.server.usePreRelease" )
74+ ) {
75+ Object . values ( servers ) . forEach ( ( server ) => server . stopServer ( ) ) ;
76+ const serversToStart = [
77+ ...new Set ( [
78+ configuration . get ( "completion.autoMode" ) ,
79+ configuration . get ( "completion.manuallyMode" ) ,
80+ ...( configuration . get ( "experimental.chat" ) &&
81+ ! configuration . get ( "cloud.use" )
82+ ? [ "chat-medium" as const ]
83+ : [ ] ) ,
84+ ] ) ,
85+ ] ;
86+ await Promise . all (
87+ serversToStart . map ( ( serverType ) => servers [ serverType ] . startServer ( ) )
88+ ) ;
89+ }
90+ } ) ;
91+
6992 ( async ( ) => {
7093 if ( configuration . get ( "cloud.use" ) ) {
7194 Logger . info ( "Use cloud for chat" , {
0 commit comments