导入方式修改
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Failing after 6m44s

This commit is contained in:
2026-05-05 23:17:00 +08:00
parent b5c15ef445
commit 3ae9daa01a
51 changed files with 445 additions and 532 deletions

View File

@@ -10,16 +10,22 @@ from pathlib import Path
# 路径设置
PROJECT_ROOT = Path(__file__).parent.parent
BACKEND_DIR = PROJECT_ROOT / "backend"
sys.path.insert(0, str(PROJECT_ROOT))
sys.path.insert(0, str(BACKEND_DIR))
import warnings
# 抑制 WebSocket 弃用警告
warnings.filterwarnings("ignore", category=DeprecationWarning, module="websockets")
warnings.filterwarnings("ignore", category=DeprecationWarning, module="uvicorn.protocols.websockets")
from dotenv import load_dotenv
load_dotenv(PROJECT_ROOT / ".env")
import asyncio
from backend.app.agent.agent_service import AIAgentService
from backend.app.agent.agent_service import AIAgentService, create_serde
from backend.app.config import DB_URI
from langgraph.checkpoint.postgres.aio import AsyncPostgresSaver
async def visualize_graph():
"""可视化 LangGraph 结构"""
print("=" * 80)
@@ -28,9 +34,7 @@ async def visualize_graph():
print(f"项目根目录: {PROJECT_ROOT}")
print(f"Backend 目录: {BACKEND_DIR}")
async with AsyncPostgresSaver.from_conn_string(DB_URI) as checkpointer:
async with AsyncPostgresSaver.from_conn_string(DB_URI, serde=create_serde()) as checkpointer:
await checkpointer.setup()
# 创建服务实例