统一 Repository 方案:添加 db 基类和子图模型 + 通讯录 API 支持真实数据库
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Has been cancelled
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Has been cancelled
This commit is contained in:
@@ -23,6 +23,8 @@ from .agent_subgraphs.common.human_review import (
|
||||
ReviewStatus,
|
||||
HumanReview
|
||||
)
|
||||
from .agent_subgraphs.contact.api_client import ContactAPIClient
|
||||
from .db.init_db import init_subgraph_tables
|
||||
from .logger import info, error
|
||||
|
||||
@asynccontextmanager
|
||||
@@ -32,6 +34,9 @@ async def lifespan(app: FastAPI):
|
||||
async with AsyncPostgresSaver.from_conn_string(DB_URI) as checkpointer:
|
||||
await checkpointer.setup()
|
||||
|
||||
# 1.5 初始化子图表
|
||||
await init_subgraph_tables(checkpointer.conn)
|
||||
|
||||
# 2. 构建 AI Agent 服务
|
||||
agent_service = AIAgentService(checkpointer)
|
||||
await agent_service.initialize()
|
||||
@@ -39,6 +44,9 @@ async def lifespan(app: FastAPI):
|
||||
# 3. 创建历史查询服务
|
||||
history_service = ThreadHistoryService(checkpointer)
|
||||
|
||||
# 3.5 创建子图 API 客户端(真实数据库模式)
|
||||
contact_api = ContactAPIClient(checkpointer.conn)
|
||||
|
||||
# 4. 创建审核管理器
|
||||
review_manager = ReviewManager(InMemoryReviewStore())
|
||||
|
||||
@@ -46,6 +54,7 @@ async def lifespan(app: FastAPI):
|
||||
app.state.agent_service = agent_service
|
||||
app.state.history_service = history_service
|
||||
app.state.review_manager = review_manager
|
||||
app.state.contact_api = contact_api
|
||||
|
||||
# 应用运行中...
|
||||
yield
|
||||
|
||||
Reference in New Issue
Block a user