fix: Agent MCP 连接短超时(10s 快速失败)+ web 600s 兜底

This commit is contained in:
2026-09-04 12:59:32 +08:00
parent fea5a57fc3
commit 19126d1a59
+2 -1
View File
@@ -44,7 +44,8 @@ class Agent:
# ---------- MCP 工具桥 ----------
async def _load_tools(self):
"""从 MCP Server 拉工具,转 OpenAI function schema。"""
self._mcp = Client(self.s.mcp_url)
# 短连接超时:MCP 不可用时快速失败(默认会无限重试卡死线程)
self._mcp = Client(self.s.mcp_url, timeout=10.0, init_timeout=10.0)
await self._mcp.__aenter__()
tools = await self._mcp.list_tools()
self.tools_schema = []