feat: 完成极简 LangGraph 架构迁移,添加 Baosi API 支持
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Failing after 6m36s

主要变更:
- 迁移到极简 LangGraph 标准架构(START → init_state → 记忆 → Agent ⇄ Tools → finalize → END)
- 添加 Baosi API 支持,配置 ops4.7 模型
- 保留本地模型作为默认首选,Baosi 作为备选
- 新架构使用 LangGraph 原生 ToolNode 和 bind_tools
- 移除旧的混合路由、JSON 解析等复杂逻辑
- 把旧代码移到 deprecated/ 目录
- 添加新的 Agent 节点和 Tools 模块
- 添加测试脚本验证新架构
- 所有测试通过 ✓
This commit is contained in:
2026-05-07 00:48:17 +08:00
parent 5e762da740
commit 22fdb625a4
23 changed files with 1232 additions and 494 deletions

View File

@@ -3,12 +3,12 @@ LangGraph 节点日志工具模块
提供状态流转追踪和 LLM 输入输出打印功能
"""
from typing import Any
from backend.app.config import ENABLE_GRAPH_TRACE
from backend.app.logger import debug, info
from ..main_graph.state import MainGraphState
def log_state_change(node_name: str, state: MainGraphState, prefix: str = "进入"):
def log_state_change(node_name: str, state: Any, prefix: str = "进入"):
"""
记录状态变化日志
@@ -53,5 +53,5 @@ def print_llm_input(prompt_value):
content_preview = str(msg.content) # 完整输出
debug(f" [{i}] {msg.type.upper():10s}: {content_preview}")
debug("\n" + "="*80 + "\n")
return prompt_value
return prompt_value