多智能体协作修改

This commit is contained in:
董宏凯 committed 2026-05-26 13:01:01 +08:00
1 parent eeb7f30585
commit d1e6cd5a8f
3 files changed
+424

No files matched your search

@@ -63,6 +63,7 @@ from fastapi.responses import StreamingResponse
# Reuse the building blocks already in multi_agent.py — keeps both routers
# identical in connection handling, payload shape, and error mapping.
from app.gateway.routers._roundtable_seed import ensure_roundtable_functional_agents
from app.gateway.routers.multi_agent import (
_auth_headers,
_create_thread,
@@ -107,6 +108,10 @@ async def init_intent(request: Request, payload: dict = Body(...)) -> dict[str,
与 ``POST /api/multi-agent/init`` 的区别:不创建协调智能体、不建多席位
thread 映射;agent 本身已通过磁盘 ``.deer-flow/agents/`` 同步注册。
"""
# 调用前自检:内网部署 .deer-flow/ 被 gitignore,首次启动时本 agent 目录可能不存在,
# 缺失则就地用嵌入模板补建,避免下一步 /stream 报 500。
ensure_roundtable_functional_agents()
base = _loopback_base(request)
headers = _auth_headers(request)
# ASGITransport:进程内直调本机 ASGI app,**不走 TCP / 不经过网络栈**,
@@ -159,6 +164,9 @@ async def stream_intent(request: Request, payload: dict = Body(...)) -> Streamin
if not message:
raise HTTPException(status_code=400, detail="message is required")
# 调用前自检:防御性二次检查——若管理员在 init 之后手动删了目录,这里也能自愈。
ensure_roundtable_functional_agents()
base = _loopback_base(request)
headers = _auth_headers(request)