Compare commits

...

2 Commits

Author SHA1 Message Date
598f40ef74 fix: 修复 docker-compose.yml 中 PostgreSQL 配置问题
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Failing after 6m57s
问题:
- docker-compose.yml 中 DB_HOST 被硬编码为 'ai-postgres',导致无法连接到远程 PostgreSQL 服务器
- 其他数据库配置也被硬编码,没有使用 .env 文件中的配置

修复:
- 将所有 PostgreSQL 配置改为从 .env 文件读取
- 添加 DB_URI 环境变量传递
2026-05-01 00:55:41 +08:00
f3bcb01777 fix: 修复 process_message_stream 中缺少 GraphContext 的问题
问题:
- 在 9d4cf15 提交中只更新了 process_message 方法,但没有更新 process_message_stream 方法
- process_message_stream 还在使用旧代码中的 GraphContext,导致报错 'name GraphContext is not defined'

修复:
- 移除了 GraphContext 的使用
- 更新 input_state 为新的 MainGraphState 格式
- 从 graph.astream() 中移除了 context 参数
2026-05-01 00:54:58 +08:00
2 changed files with 13 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ from ..model_services.chat_services import get_all_chat_services, LocalVLLMChatP
from app.main_graph.utils.rag_initializer import init_rag_tool from app.main_graph.utils.rag_initializer import init_rag_tool
from app.core.intent_classifier import get_intent_classifier from app.core.intent_classifier import get_intent_classifier
from app.logger import info, warning from app.logger import info, warning
from app.main_graph.state import MainGraphState, CurrentAction
class AIAgentService: class AIAgentService:
def __init__(self, checkpointer): def __init__(self, checkpointer):
@@ -120,8 +121,12 @@ class AIAgentService:
"configurable": {"thread_id": thread_id}, "configurable": {"thread_id": thread_id},
"metadata": {"user_id": user_id} "metadata": {"user_id": user_id}
} }
input_state = {"messages": [{"role": "user", "content": message}]} input_state = {
context = GraphContext(user_id=user_id) "user_query": message,
"messages": [{"role": "user", "content": message}],
"user_id": user_id,
"current_action": CurrentAction.NONE
}
# ========== 新增:混合路由 ========== # ========== 新增:混合路由 ==========
intent_result = await self.intent_classifier.classify(message) intent_result = await self.intent_classifier.classify(message)
@@ -161,7 +166,6 @@ class AIAgentService:
async for chunk in graph.astream( async for chunk in graph.astream(
input_state, input_state,
config=config, config=config,
context=context,
stream_mode=["messages", "updates", "custom"], stream_mode=["messages", "updates", "custom"],
version="v2", version="v2",
subgraphs=True subgraphs=True

View File

@@ -15,11 +15,12 @@ services:
# ========================================================================= # =========================================================================
# PostgreSQL 数据库配置 # PostgreSQL 数据库配置
# ========================================================================= # =========================================================================
- DB_HOST=ai-postgres - DB_HOST=${DB_HOST}
- DB_PORT=5432 - DB_PORT=${DB_PORT}
- DB_USER=postgres - DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD:?请配置 DB_PASSWORD本地.env 文件 | CI/CDSecrets} # ⭐ 敏感密钥配置 - DB_PASSWORD=${DB_PASSWORD}
- DB_NAME=langgraph_db - DB_NAME=${DB_NAME}
- DB_URI=${DB_URI}
# ========================================================================= # =========================================================================
# Qdrant 向量数据库配置URL + API密钥 配对) # Qdrant 向量数据库配置URL + API密钥 配对)