This commit is contained in:
@@ -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()
|
||||
|
||||
# 创建服务实例
|
||||
|
||||
Reference in New Issue
Block a user