From c29f676cb355a9b486bba7892ab3bf20e67baec2 Mon Sep 17 00:00:00 2001 From: ymq Date: Sat, 15 Aug 2026 10:02:54 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20cockpit=20AgentIO=E9=80=82=E9=85=8D?= =?UTF-8?q?gateway=E7=BB=9F=E4=B8=80=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/api/cockpit_chat_v2.dspy | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/wwwroot/api/cockpit_chat_v2.dspy b/wwwroot/api/cockpit_chat_v2.dspy index 855c1a9..07b2f7c 100644 --- a/wwwroot/api/cockpit_chat_v2.dspy +++ b/wwwroot/api/cockpit_chat_v2.dspy @@ -63,24 +63,17 @@ if action == 'send_message': ctx['name'] = getattr(proj_recs[0], 'name', '') ctx['pipeline_id'] = getattr(proj_recs[0], 'pipeline_id', '') or '' - # ── 加载 v2 引擎 ── - from pipeline_core.agent_config import load_agent_config - from pipeline_service.agent_loop_v2 import AgentExecutor - - config = await load_agent_config(pipeline_id=ctx['pipeline_id'], project_id=ctx['pid']) - executor = AgentExecutor( - config=config, - project_id=ctx['pid'], - user_id=uid, - ) + # ── 走 gateway 统一入口(Web AgentIO 通道)── + from pipeline_service.gateway import get_gateway + gateway = get_gateway() async def agent_stream(): # 项目上下文 if ctx['name']: yield json.dumps({"reasoning_content": "项目: " + ctx['name'] + "\n"}, ensure_ascii=False) + '\n' - # 运行 AgentExecutor(输出 content 流式格式,供前端 AgentIO→AgentOut 渲染) - async for chunk in executor.run(prompt): + # 运行 gateway(输出 content 流式格式,供前端 AgentIO→AgentOut 渲染) + async for chunk in gateway.run_message("web", uid, prompt): data = json.loads(chunk) t = data.get('type', '')