bugfix:修复一些bug

This commit is contained in:
2026-10-02 02:36:11 -07:00
parent 68588d1f92
commit 5b1e6c5654
14 changed files with 37 additions and 81 deletions
+6
View File
@@ -17,6 +17,7 @@ from app.core.logging import setup_logging
@asynccontextmanager
async def lifespan(application: FastAPI):
setup_logging()
from app.agent.screen_agent import get_screen_agent
from app.clients.decision import close_decision_engine
from app.clients.mcp import start_mcp_servers, stop_mcp_servers
from app.clients.user_center import close_user_center
@@ -35,6 +36,11 @@ async def lifespan(application: FastAPI):
await warm_material_cache(persistence.db)
# 拉起 mcp_servers.json 中由应用管理的服务;单个服务失败只记录,用到它的请求执行时报错
mcp_processes = await start_mcp_servers()
# 提前拉取 MCP 工具并组装 agent,问题在启动时暴露;失败只记录,首个请求会重试
try:
await get_screen_agent()
except Exception as error:
logger.opt(exception=error).error("screen agent 预先组装失败")
application.state.agent_service = AgentService(
build_graph(persistence.checkpointer), persistence.store
)