From 041c79f3b76f7f7bfb2273d6a8a5c27ffc9d4d2c Mon Sep 17 00:00:00 2001 From: JOJO <1498581755@qq.com> Date: Tue, 18 Nov 2025 10:35:12 +0800 Subject: [PATCH] fix(web): persist thinking mode toggle --- core/web_terminal.py | 5 +---- static/app.js | 13 ++----------- static/index.html | 2 +- utils/api_client.py | 4 ++++ web_server.py | 9 +-------- 5 files changed, 9 insertions(+), 24 deletions(-) diff --git a/core/web_terminal.py b/core/web_terminal.py index 5b6881b..8ee8781 100644 --- a/core/web_terminal.py +++ b/core/web_terminal.py @@ -252,10 +252,7 @@ class WebTerminal(MainTerminal): # 构建状态信息 status = { "project_path": self.project_path, - "thinking_mode": { - "enabled": self.thinking_mode, - "label": self.get_thinking_mode_status() - }, + "thinking_mode": self.thinking_mode, "thinking_status": self.get_thinking_mode_status(), "context": { "usage_percent": context_status['usage_percent'], diff --git a/static/app.js b/static/app.js index 82205d3..fc6ada6 100644 --- a/static/app.js +++ b/static/app.js @@ -592,11 +592,7 @@ async function bootstrapApp() { this.socket.on('system_ready', (data) => { this.projectPath = data.project_path || ''; this.agentVersion = data.version || this.agentVersion; - if (typeof data.thinking_mode === 'object') { - this.thinkingMode = !!data.thinking_mode.enabled; - } else { - this.thinkingMode = data.thinking_mode === '思考模式'; - } + this.thinkingMode = !!data.thinking_mode; console.log('系统就绪:', data); // 系统就绪后立即加载对话列表 @@ -1293,7 +1289,6 @@ async function bootstrapApp() { this.toolMenuOpen = false; this.toolSettingsLoading = false; this.toolSettings = []; - this.thinkingMode = false; console.log('前端状态重置完成'); }, @@ -1326,11 +1321,7 @@ async function bootstrapApp() { const statusData = await statusResponse.json(); this.projectPath = statusData.project_path || ''; this.agentVersion = statusData.version || this.agentVersion; - if (statusData.thinking_mode) { - this.thinkingMode = !!statusData.thinking_mode.enabled; - } else { - this.thinkingMode = false; - } + this.thinkingMode = !!statusData.thinking_mode; // 获取当前对话信息 const statusConversationId = statusData.conversation && statusData.conversation.current_id; diff --git a/static/index.html b/static/index.html index 567c488..23a10ae 100644 --- a/static/index.html +++ b/static/index.html @@ -538,7 +538,7 @@ class="menu-btn mode-entry" @click="toggleThinkingMode" :disabled="streamingMessage || !isConnected"> - {{ thinkingMode ? '当前:思考模式(点此切换为快速模式)' : '当前:快速模式(点此切换为思考模式)' }} + {{ thinkingMode ? '思考模式' : '快速模式' }}