refactor: cockpit AgentIO适配gateway统一入口
This commit is contained in:
parent
d36d5ed4f6
commit
c29f676cb3
@ -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', '')
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user