All checks were successful
构建并部署 AI Agent 服务 / deploy (push) Successful in 12m9s
## 核心改动 ### 1. 单图方案重构 - 删除了多图(self.graphs),改为单图(self.graph) - 新增 MainGraphState.current_model 字段用于运行时注入模型 - llm_call 节点改为动态选择模型(create_dynamic_llm_call_node) ### 2. chat_services 优化 - 添加 _cached_services 缓存,避免重复初始化 - 新增 get_cached_chat_services() 函数,用于单图注入 - 新增 _check_http_service_available() 统一HTTP探测逻辑 - 减少重复代码,LocalVLLMChatProvider和LocalSmallModelProvider共用探测方法 ### 3. AIAgentService 重构 - initialize() 只构建一次图,传入 chat_services 字典 - 新增 _resolve_model() 模型回退逻辑 - 新增 _build_invocation() 统一构建调用参数 - process_message() 和 process_message_stream() 改为注入 current_model - 流式处理代码拆分,增加可读性 ### 4. 新增和删除文件 - 新增:backend/app/main_graph/main_graph_builder.py(图构建) - 新增:backend/app/main_graph/subgraph_wrapper.py(子图封装) - 新增:tools/test/test_tavily_search.py(测试) - 删除:backend/app/main_graph/graph.py(旧图) - 删除:backend/app/main_graph/utils/main_graph_builder.py(旧构建器) - 删除:backend/app/main_graph/utils/__init__.py ### 5. 其他更新 - README.md:新增模型服务使用情况详解章节 - backend/app/model_services/__init__.py:新增 get_cached_chat_services 导出 ## 方案优势 - 内存优化:N张图 → 1张图 - 灵活性:运行时动态选择模型,支持同会话不同模型 - 性能:模型服务缓存,初始化仅一次 - 可维护性:减少重复代码,统一HTTP探测逻辑
53 lines
1003 B
Plaintext
53 lines
1003 B
Plaintext
typing-extensions>=4.15.0
|
||
python-dotenv>=1.2.2
|
||
pydantic>=2.12.5
|
||
requests>=2.32.5
|
||
|
||
# LangChain
|
||
langchain>=1.2.15
|
||
langchain-community>=0.4.1
|
||
langchain-core>=1.2.28
|
||
langchain-openai>=1.1.12
|
||
langchain-qdrant>=1.1.0
|
||
langgraph>=1.1.6
|
||
langgraph-checkpoint-postgres>=3.0.5
|
||
tiktoken>=0.12.0
|
||
|
||
# Zhipu AI
|
||
zhipuai>=2.0.1
|
||
|
||
# Vector DB
|
||
qdrant-client>=1.17.1
|
||
fastembed>=0.3.0 # 用于 Qdrant BM25 稀疏向量
|
||
|
||
# Memory
|
||
mem0ai>=1.0.11
|
||
|
||
# Backend
|
||
fastapi>=0.135.3
|
||
uvicorn[standard]>=0.44.0
|
||
|
||
# Database
|
||
asyncpg>=0.31.0
|
||
psycopg[binary]>=3.3.3
|
||
|
||
# HTTP
|
||
httpx>=0.28.1
|
||
aiohttp>=3.13.5
|
||
|
||
# Utilities
|
||
tenacity>=9.1.4
|
||
rich>=15.0.0
|
||
PyYAML>=6.0.3
|
||
numpy>=1.26.2
|
||
pyjwt>=2.8.0
|
||
ddgs>=6.0.0 # 免费联网搜索(原 duckduckgo-search 已重命名)
|
||
tavily-python>=0.5.0 # Tavily 搜索 API(需要 API Key,质量更高)
|
||
matplotlib>=3.9.0 # 可视化图表
|
||
|
||
# Document Processing
|
||
unstructured>=0.22.21
|
||
pypdf>=6.10.0
|
||
beautifulsoup4>=4.14.3
|
||
lxml>=6.1.0
|
||
spacy>=3.8.14 # unstructured 可能依赖 |