From 3051a34ce72e5f4c0f31f3bc2e6a6d91f364e6d5 Mon Sep 17 00:00:00 2001
From: root <953994191@qq.com>
Date: Fri, 1 May 2026 13:27:20 +0800
Subject: [PATCH] =?UTF-8?q?temp:=20=E4=B8=8D=E6=98=BE=E7=A4=BAreact=5Freas?=
=?UTF-8?q?on=E7=9A=84=E8=B0=83=E8=AF=95=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/components/chat_area.py | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/frontend/src/components/chat_area.py b/frontend/src/components/chat_area.py
index f07e227..32323ea 100644
--- a/frontend/src/components/chat_area.py
+++ b/frontend/src/components/chat_area.py
@@ -194,7 +194,7 @@ def _handle_ai_response():
# 2. 本地模型 标签模式 (如 Gemma, 本地 DeepSeek)
if "" in raw_text:
- think_match = re.search(r'(.*?)(|$)', raw_text, re.DOTALL)
+ think_match = re.search(r"(.*?)(|$)", raw_text, re.DOTALL)
if think_match:
display_thought = think_match.group(1).strip()
is_thinking = "" not in raw_text
@@ -202,14 +202,14 @@ def _handle_ai_response():
# 正文部分应该是除去了整个 ... 块后的剩余内容
# 注意:流式输出时可能 还没出来,此时也要把 到末尾的部分剔除,只显示正文
if is_thinking:
- display_text = re.sub(r'.*$', '', raw_text, flags=re.DOTALL).strip()
+ display_text = re.sub(r".*$", "", raw_text, flags=re.DOTALL).strip()
else:
- display_text = re.sub(r'.*?', '', raw_text, flags=re.DOTALL).strip()
+ display_text = re.sub(r".*?", "", raw_text, flags=re.DOTALL).strip()
elif "<" in raw_text and "think" in raw_text and not raw_text.startswith(""):
# 处理一种特殊情况:模型正在输出 标签的过程中(例如刚输出了 "",会导致残缺的标签显示在正文中
# 我们做个简单拦截:如果在开头发现了不完整的标签,暂时不显示它
- if re.match(r'^]*$', raw_text):
+ if re.match(r"^]*$", raw_text):
display_text = ""
is_thinking = True
@@ -229,14 +229,6 @@ def _handle_ai_response():
if display_text or not is_thinking:
cursor = "▌" if not is_thinking else ""
message_placeholder.markdown(display_text + cursor)
- else:
- # 对于非 llm_call/fallback 的 token,记录到思考过程用于调试
- token = str(event.get("token", ""))
- reasoning_token = str(event.get("reasoning_token", ""))
- if token:
- api_thought += f"\n[调试] 节点 {node_name} 输出: {repr(token)}"
- display_thought = api_thought
- thought_placeholder.info(f"**🤔 思考过程 (正在思考...)**\n\n{display_thought}▌")
# 2. 处理状态更新 (节点完成、工具结果等)
elif event_type == "state_update":