修改前端,支持 react_reasoning 自定义事件显示
All checks were successful
构建并部署 AI Agent 服务 / deploy (push) Successful in 5m21s

This commit is contained in:
2026-05-02 10:32:01 +08:00
parent e67ec97a12
commit 3e9462a693

View File

@@ -159,7 +159,39 @@ def _handle_ai_response():
thought_placeholder.info(f"**🤔 思考过程 (正在思考...)**\n\n{display_thought}")
# 2. 处理各种控制事件,显示到思考过程
if event_type == "intent_classified":
elif event_type == "react_reasoning":
# 处理我们自定义的推理事件(来自 react_reason_node, web_search, rag, 子图等)
step = event.get("step", 1)
action = event.get("action", "unknown")
confidence = event.get("confidence", 0)
reasoning = event.get("reasoning", "")
# 根据 action 类型显示不同的图标
action_icon = "🤔"
if "web_search" in action:
action_icon = "🌐"
elif "rag" in action or "retrieve" in action:
action_icon = "📚"
elif "subgraph" in action:
action_icon = "📦"
elif "DIRECT" in action:
action_icon = "💬"
elif "ROUTE" in action:
action_icon = "🔀"
elif "TOOL" in action:
action_icon = "🔧"
api_thought += f"\n\n{action_icon} **第 {step} 次推理**"
api_thought += f"\n 📋 动作: {action}"
if confidence > 0:
api_thought += f"\n 📊 置信度: {confidence:.2f}"
if reasoning:
api_thought += f"\n 💭 {reasoning}"
display_thought = api_thought
thought_placeholder.info(f"**🤔 思考过程 (正在思考...)**\n\n{display_thought}")
elif event_type == "intent_classified":
intent = event.get("intent", "unknown")
confidence = event.get("confidence", 0)
reasoning = event.get("reasoning", "")