mirror of
https://github.com/cline/cline.git
synced 2026-09-21 05:10:09 +08:00
Get the chatsettings back to global
This commit is contained in:
@@ -400,9 +400,9 @@ export class Controller {
|
||||
}
|
||||
}
|
||||
|
||||
// Save only non-mode properties to workspace storage
|
||||
// Save only non-mode properties to global storage
|
||||
const { mode, ...persistentChatSettings }: { mode: string } & StoredChatSettings = chatSettings
|
||||
await updateWorkspaceState(this.context, "chatSettings", persistentChatSettings)
|
||||
await updateGlobalState(this.context, "chatSettings", persistentChatSettings)
|
||||
await this.postStateToWebview()
|
||||
|
||||
if (this.task) {
|
||||
|
||||
@@ -59,22 +59,17 @@ export async function updateSettings(controller: Controller, request: UpdateSett
|
||||
if (request.chatSettings) {
|
||||
const chatSettings = convertProtoChatSettingsToChatSettings(request.chatSettings)
|
||||
|
||||
// Split settings: mode goes to global, other settings to workspace
|
||||
// Store mode to global state
|
||||
if (chatSettings.mode !== undefined) {
|
||||
await controller.context.globalState.update("mode", chatSettings.mode)
|
||||
}
|
||||
|
||||
// Store workspace-specific settings (excluding mode)
|
||||
const { mode, ...workspaceChatSettings } = chatSettings
|
||||
await controller.context.workspaceState.update("chatSettings", workspaceChatSettings)
|
||||
// Store chat settings (excluding mode) to global state
|
||||
const { mode, ...globalChatSettings } = chatSettings
|
||||
await controller.context.globalState.update("chatSettings", globalChatSettings)
|
||||
|
||||
if (controller.task) {
|
||||
// Ensure task settings include the current mode from global state
|
||||
const currentMode = (await controller.context.globalState.get("mode")) as "plan" | "act" | undefined
|
||||
controller.task.chatSettings = {
|
||||
...chatSettings,
|
||||
mode: chatSettings.mode || currentMode || "plan",
|
||||
}
|
||||
controller.task.chatSettings = chatSettings
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ export type GlobalStateKey =
|
||||
| "sapAiResourceGroup"
|
||||
| "claudeCodePath"
|
||||
// Settings around plan/act and ephemeral model configuration
|
||||
| "chatSettings"
|
||||
| "mode"
|
||||
// Current active model configuration (per workspace)
|
||||
| "apiProvider"
|
||||
@@ -112,9 +113,4 @@ export type GlobalStateKey =
|
||||
| "previousModeAwsBedrockCustomModelBaseId"
|
||||
| "previousModeSapAiCoreModelId"
|
||||
|
||||
export type LocalStateKey =
|
||||
| "localClineRulesToggles"
|
||||
| "localCursorRulesToggles"
|
||||
| "localWindsurfRulesToggles"
|
||||
| "workflowToggles"
|
||||
| "chatSettings"
|
||||
export type LocalStateKey = "localClineRulesToggles" | "localCursorRulesToggles" | "localWindsurfRulesToggles" | "workflowToggles"
|
||||
|
||||
@@ -204,7 +204,7 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
|
||||
const localClineRulesToggles = (await getWorkspaceState(context, "localClineRulesToggles")) as ClineRulesToggles
|
||||
|
||||
const [
|
||||
workspaceChatSettings,
|
||||
chatSettings,
|
||||
currentMode,
|
||||
storedApiProvider,
|
||||
apiModelId,
|
||||
@@ -236,7 +236,7 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
|
||||
previousModeSapAiCoreModelId,
|
||||
sapAiCoreModelId,
|
||||
] = await Promise.all([
|
||||
getWorkspaceState(context, "chatSettings") as Promise<StoredChatSettings | undefined>,
|
||||
getGlobalState(context, "chatSettings") as Promise<StoredChatSettings | undefined>,
|
||||
getGlobalState(context, "mode") as Promise<"plan" | "act" | undefined>,
|
||||
getGlobalState(context, "apiProvider") as Promise<ApiProvider | undefined>,
|
||||
getGlobalState(context, "apiModelId") as Promise<string | undefined>,
|
||||
@@ -391,7 +391,7 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
|
||||
browserSettings: { ...DEFAULT_BROWSER_SETTINGS, ...browserSettings }, // this will ensure that older versions of browserSettings (e.g. before remoteBrowserEnabled was added) are merged with the default values (false for remoteBrowserEnabled)
|
||||
chatSettings: {
|
||||
...DEFAULT_CHAT_SETTINGS, // Apply defaults first
|
||||
...(workspaceChatSettings || {}), // Spread fetched workspace chatSettings, which includes preferredLanguage, and openAIReasoningEffort
|
||||
...(chatSettings || {}), // Spread fetched global chatSettings, which includes preferredLanguage, and openAIReasoningEffort
|
||||
mode: currentMode || "plan", // Merge mode from global state
|
||||
},
|
||||
userInfo,
|
||||
|
||||
Reference in New Issue
Block a user