重构:简化流式架构,将 ReAct 循环移入 agent 节点
All checks were successful
构建并部署 AI Agent 服务 / deploy (push) Successful in 5m41s

主要变更:
- 简化 agent_service:移除复杂双协程,只用 stream_mode=["updates"]
- stream_context:提供更清晰的 API (set_stream_queue/get_stream_queue)
- main_graph_builder:简化图结构,移除 tools 节点和条件边
- agent 节点:包含完整 ReAct 循环 + 流式 Tool Calling 拼接
- 前端:适配新的事件格式
- 添加测试文件:test_full_react_streaming.py, test_stream.py
This commit is contained in:
2026-05-07 02:56:35 +08:00
parent eb33203b5c
commit 5b41598d50
8 changed files with 450 additions and 367 deletions

View File

@@ -226,7 +226,7 @@ def _handle_ai_response():
elif event_type == "llm_token":
node_name = event.get("node", "unknown")
# 确保只处理来自 LLM 的 token避免将工具的输出作为 token 显示
if node_name in ("llm_call", "fallback"):
if node_name in ("llm_call", "fallback", "agent"):
token = str(event.get("token", ""))
reasoning_token = str(event.get("reasoning_token", ""))