From 27ab50ae68f9d1a43ef0ade1013ce4c23731b2ce Mon Sep 17 00:00:00 2001 From: qing <1776177662@qq.com> Date: Sat, 1 Aug 2026 20:53:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(aibox/botops):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E8=BE=93=E5=87=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 服务端:is_continuation(工具调用后递归继续)时不再重复发送 "思考中"提示和reasoning_start信号,避免多轮工具调用时侧栏 出现多条冗余"思考中"消息 2. BotOps:line消息过滤前缀从5个扩展到9个,过滤掉"分析工具结果" "需要调用工具"等被后续具体信息覆盖的过渡提示 3. BotOps:移除危险的fallback分支(未知消息类型直接append到AI 聊天区),改为写入侧栏日志,防止非AI内容污染回复 --- BotOps/app.py | 15 +++++++++++---- aibox/aibox.py | 4 +++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/BotOps/app.py b/BotOps/app.py index ca3170f..0b8f450 100644 --- a/BotOps/app.py +++ b/BotOps/app.py @@ -186,10 +186,16 @@ class BotOpsApp(App): stripped = content.strip() if not stripped: pass - elif stripped.startswith(("💬 助手", "💬 Assistant", "🤔 思考中", "🤔 Thinking", "🤔 深度思考中")): - pass # 助手前缀 / 思考提示:聊天区已有对应区域,无需展示 + elif stripped.startswith(( + "💬 助手", "💬 Assistant", # 助手前缀(聊天区已有对应区域) + "🤔 思考中", "🤔 Thinking", # 思考提示(聊天区已有思考区域) + "🤔 深度思考中", + "🤔 分析工具结果", "🤔 Analyzing", # 工具分析提示(后续有具体工具输出,此为冗余) + "🔧 需要调用工具", "🔧 Need to call",# 工具调用前置提示(后续有"调用工具: xxx"具体提示) + )): + pass # 冗余/有替代展示的提示行,过滤避免重复 else: - # 🔧 调用工具 / 工具输出 / 🤔 分析工具结果 等 → 任务侧栏 + # 🔧 调用工具: xxx / 工具输出 / 用户中断提示等 → 任务侧栏 self.tasks.write(stripped) elif t == "complete": # complete 携带完整全文,用于对齐已显示内容 @@ -244,7 +250,8 @@ class BotOpsApp(App): elif t == "notification": await self.notify_system(f"🔔 {content}") elif content: - await self.chat.append_ai(content) + # 未知消息类型不追加到AI聊天区(避免非AI内容污染回复),仅记入侧栏日志 + self.tasks.write(f"[未知消息 type={t}] {str(content)[:200]}") # ── 连接状态回调 ────────────────────────────────────────────────────── async def _on_ws_state(self, state: str, detail: str): diff --git a/aibox/aibox.py b/aibox/aibox.py index 86284a1..2334e97 100644 --- a/aibox/aibox.py +++ b/aibox/aibox.py @@ -7267,7 +7267,9 @@ class DeepSeekChat: payload["tool_choice"] = "auto" current_time = datetime.now().strftime("%H:%M:%S") - if output_callback: + if output_callback and not is_continuation: + # 工具调用后的递归继续(is_continuation=True)时不重复发送"思考中"提示, + # 因为前端已处于活跃AI状态,重复提示会导致冗余/重复输出 output_callback("line", f"\n{i18n.get('thinking', current_time)}\n") if constants.REASONING_ENABLED: output_callback("reasoning_start", "🤔 思考中...")