@@ -114,7 +114,7 @@ export class Controller {
114114 try {
115115 await storeSecret ( this . context , "clineApiKey" , undefined )
116116 await updateGlobalState ( this . context , "userInfo" , undefined )
117- await updateGlobalState ( this . context , "apiProvider" , "openrouter" )
117+ await updateWorkspaceState ( this . context , "apiProvider" , "openrouter" )
118118 await this . postStateToWebview ( )
119119 vscode . window . showInformationMessage ( "Successfully logged out of Cline" )
120120 } catch ( error ) {
@@ -297,9 +297,9 @@ export class Controller {
297297
298298 if ( shouldSwitchModel ) {
299299 // Save the last model used in this mode
300- await updateGlobalState ( this . context , "previousModeApiProvider" , apiConfiguration . apiProvider )
301- await updateGlobalState ( this . context , "previousModeThinkingBudgetTokens" , apiConfiguration . thinkingBudgetTokens )
302- await updateGlobalState ( this . context , "previousModeReasoningEffort" , apiConfiguration . reasoningEffort )
300+ await updateWorkspaceState ( this . context , "previousModeApiProvider" , apiConfiguration . apiProvider )
301+ await updateWorkspaceState ( this . context , "previousModeThinkingBudgetTokens" , apiConfiguration . thinkingBudgetTokens )
302+ await updateWorkspaceState ( this . context , "previousModeReasoningEffort" , apiConfiguration . reasoningEffort )
303303 switch ( apiConfiguration . apiProvider ) {
304304 case "anthropic" :
305305 case "vertex" :
@@ -309,51 +309,51 @@ export class Controller {
309309 case "qwen" :
310310 case "deepseek" :
311311 case "xai" :
312- await updateGlobalState ( this . context , "previousModeModelId" , apiConfiguration . apiModelId )
312+ await updateWorkspaceState ( this . context , "previousModeModelId" , apiConfiguration . apiModelId )
313313 break
314314 case "bedrock" :
315- await updateGlobalState ( this . context , "previousModeModelId" , apiConfiguration . apiModelId )
316- await updateGlobalState (
315+ await updateWorkspaceState ( this . context , "previousModeModelId" , apiConfiguration . apiModelId )
316+ await updateWorkspaceState (
317317 this . context ,
318318 "previousModeAwsBedrockCustomSelected" ,
319319 apiConfiguration . awsBedrockCustomSelected ,
320320 )
321- await updateGlobalState (
321+ await updateWorkspaceState (
322322 this . context ,
323323 "previousModeAwsBedrockCustomModelBaseId" ,
324324 apiConfiguration . awsBedrockCustomModelBaseId ,
325325 )
326326 break
327327 case "openrouter" :
328328 case "cline" :
329- await updateGlobalState ( this . context , "previousModeModelId" , apiConfiguration . openRouterModelId )
330- await updateGlobalState ( this . context , "previousModeModelInfo" , apiConfiguration . openRouterModelInfo )
329+ await updateWorkspaceState ( this . context , "previousModeModelId" , apiConfiguration . openRouterModelId )
330+ await updateWorkspaceState ( this . context , "previousModeModelInfo" , apiConfiguration . openRouterModelInfo )
331331 break
332332 case "vscode-lm" :
333333 // Important we don't set modelId to this, as it's an object not string (webview expects model id to be a string)
334- await updateGlobalState (
334+ await updateWorkspaceState (
335335 this . context ,
336336 "previousModeVsCodeLmModelSelector" ,
337337 apiConfiguration . vsCodeLmModelSelector ,
338338 )
339339 break
340340 case "openai" :
341- await updateGlobalState ( this . context , "previousModeModelId" , apiConfiguration . openAiModelId )
342- await updateGlobalState ( this . context , "previousModeModelInfo" , apiConfiguration . openAiModelInfo )
341+ await updateWorkspaceState ( this . context , "previousModeModelId" , apiConfiguration . openAiModelId )
342+ await updateWorkspaceState ( this . context , "previousModeModelInfo" , apiConfiguration . openAiModelInfo )
343343 break
344344 case "ollama" :
345- await updateGlobalState ( this . context , "previousModeModelId" , apiConfiguration . ollamaModelId )
345+ await updateWorkspaceState ( this . context , "previousModeModelId" , apiConfiguration . ollamaModelId )
346346 break
347347 case "lmstudio" :
348- await updateGlobalState ( this . context , "previousModeModelId" , apiConfiguration . lmStudioModelId )
348+ await updateWorkspaceState ( this . context , "previousModeModelId" , apiConfiguration . lmStudioModelId )
349349 break
350350 case "litellm" :
351- await updateGlobalState ( this . context , "previousModeModelId" , apiConfiguration . liteLlmModelId )
352- await updateGlobalState ( this . context , "previousModeModelInfo" , apiConfiguration . liteLlmModelInfo )
351+ await updateWorkspaceState ( this . context , "previousModeModelId" , apiConfiguration . liteLlmModelId )
352+ await updateWorkspaceState ( this . context , "previousModeModelInfo" , apiConfiguration . liteLlmModelInfo )
353353 break
354354 case "requesty" :
355- await updateGlobalState ( this . context , "previousModeModelId" , apiConfiguration . requestyModelId )
356- await updateGlobalState ( this . context , "previousModeModelInfo" , apiConfiguration . requestyModelInfo )
355+ await updateWorkspaceState ( this . context , "previousModeModelId" , apiConfiguration . requestyModelId )
356+ await updateWorkspaceState ( this . context , "previousModeModelInfo" , apiConfiguration . requestyModelInfo )
357357 break
358358 }
359359
@@ -365,9 +365,9 @@ export class Controller {
365365 newReasoningEffort ||
366366 newVsCodeLmModelSelector
367367 ) {
368- await updateGlobalState ( this . context , "apiProvider" , newApiProvider )
369- await updateGlobalState ( this . context , "thinkingBudgetTokens" , newThinkingBudgetTokens )
370- await updateGlobalState ( this . context , "reasoningEffort" , newReasoningEffort )
368+ await updateWorkspaceState ( this . context , "apiProvider" , newApiProvider )
369+ await updateWorkspaceState ( this . context , "thinkingBudgetTokens" , newThinkingBudgetTokens )
370+ await updateWorkspaceState ( this . context , "reasoningEffort" , newReasoningEffort )
371371 switch ( newApiProvider ) {
372372 case "anthropic" :
373373 case "vertex" :
@@ -377,38 +377,38 @@ export class Controller {
377377 case "qwen" :
378378 case "deepseek" :
379379 case "xai" :
380- await updateGlobalState ( this . context , "apiModelId" , newModelId )
380+ await updateWorkspaceState ( this . context , "apiModelId" , newModelId )
381381 break
382382 case "bedrock" :
383- await updateGlobalState ( this . context , "apiModelId" , newModelId )
384- await updateGlobalState ( this . context , "awsBedrockCustomSelected" , newAwsBedrockCustomSelected )
385- await updateGlobalState ( this . context , "awsBedrockCustomModelBaseId" , newAwsBedrockCustomModelBaseId )
383+ await updateWorkspaceState ( this . context , "apiModelId" , newModelId )
384+ await updateWorkspaceState ( this . context , "awsBedrockCustomSelected" , newAwsBedrockCustomSelected )
385+ await updateWorkspaceState ( this . context , "awsBedrockCustomModelBaseId" , newAwsBedrockCustomModelBaseId )
386386 break
387387 case "openrouter" :
388388 case "cline" :
389- await updateGlobalState ( this . context , "openRouterModelId" , newModelId )
390- await updateGlobalState ( this . context , "openRouterModelInfo" , newModelInfo )
389+ await updateWorkspaceState ( this . context , "openRouterModelId" , newModelId )
390+ await updateWorkspaceState ( this . context , "openRouterModelInfo" , newModelInfo )
391391 break
392392 case "vscode-lm" :
393- await updateGlobalState ( this . context , "vsCodeLmModelSelector" , newVsCodeLmModelSelector )
393+ await updateWorkspaceState ( this . context , "vsCodeLmModelSelector" , newVsCodeLmModelSelector )
394394 break
395395 case "openai" :
396- await updateGlobalState ( this . context , "openAiModelId" , newModelId )
397- await updateGlobalState ( this . context , "openAiModelInfo" , newModelInfo )
396+ await updateWorkspaceState ( this . context , "openAiModelId" , newModelId )
397+ await updateWorkspaceState ( this . context , "openAiModelInfo" , newModelInfo )
398398 break
399399 case "ollama" :
400- await updateGlobalState ( this . context , "ollamaModelId" , newModelId )
400+ await updateWorkspaceState ( this . context , "ollamaModelId" , newModelId )
401401 break
402402 case "lmstudio" :
403- await updateGlobalState ( this . context , "lmStudioModelId" , newModelId )
403+ await updateWorkspaceState ( this . context , "lmStudioModelId" , newModelId )
404404 break
405405 case "litellm" :
406- await updateGlobalState ( this . context , "previousModeModelId" , apiConfiguration . liteLlmModelId )
407- await updateGlobalState ( this . context , "previousModeModelInfo" , apiConfiguration . liteLlmModelInfo )
406+ await updateWorkspaceState ( this . context , "previousModeModelId" , apiConfiguration . liteLlmModelId )
407+ await updateWorkspaceState ( this . context , "previousModeModelInfo" , apiConfiguration . liteLlmModelInfo )
408408 break
409409 case "requesty" :
410- await updateGlobalState ( this . context , "requestyModelId" , newModelId )
411- await updateGlobalState ( this . context , "requestyModelInfo" , newModelInfo )
410+ await updateWorkspaceState ( this . context , "requestyModelId" , newModelId )
411+ await updateWorkspaceState ( this . context , "requestyModelInfo" , newModelInfo )
412412 break
413413 }
414414
@@ -419,7 +419,7 @@ export class Controller {
419419 }
420420 }
421421
422- await updateGlobalState ( this . context , "chatSettings" , chatSettings )
422+ await updateWorkspaceState ( this . context , "chatSettings" , chatSettings )
423423 await this . postStateToWebview ( )
424424
425425 if ( this . task ) {
@@ -510,7 +510,7 @@ export class Controller {
510510 await sendAuthCallbackEvent ( customToken )
511511
512512 const clineProvider : ApiProvider = "cline"
513- await updateGlobalState ( this . context , "apiProvider" , clineProvider )
513+ await updateWorkspaceState ( this . context , "apiProvider" , clineProvider )
514514
515515 // Update API configuration with the new provider and API key
516516 const { apiConfiguration } = await getAllExtensionState ( this . context )
@@ -669,7 +669,7 @@ export class Controller {
669669 }
670670
671671 const openrouter : ApiProvider = "openrouter"
672- await updateGlobalState ( this . context , "apiProvider" , openrouter )
672+ await updateWorkspaceState ( this . context , "apiProvider" , openrouter )
673673 await storeSecret ( this . context , "openRouterApiKey" , apiKey )
674674 await this . postStateToWebview ( )
675675 if ( this . task ) {
0 commit comments