feat: cockpit 会话传 pipeline_id,支持产线缺省模型

This commit is contained in:
p 2026-08-14 18:03:06 +08:00
parent ebcb89da56
commit f68755edf8

View File

@ -49,7 +49,7 @@ if action == 'send_message':
uid = 'user-01' # 测试兼容
# ── 加载上下文 ──
ctx = {'pid': '', 'name': ''}
ctx = {'pid': '', 'name': '', 'pipeline_id': ''}
async with DBPools().sqlorContext(dbname) as sor:
recs = await sor.sqlExe(
"SELECT current_project_id FROM pipeline_agent_settings WHERE user_id=${u}$",
@ -58,15 +58,16 @@ if action == 'send_message':
ctx['pid'] = getattr(recs[0], 'current_project_id', '') or ''
if ctx['pid']:
proj_recs = await sor.sqlExe(
"SELECT name FROM sd_projects WHERE id=${p}$", {"p": ctx['pid']})
"SELECT name, pipeline_id FROM sd_projects WHERE id=${p}$", {"p": ctx['pid']})
if proj_recs:
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(project_id=ctx['pid'])
config = await load_agent_config(pipeline_id=ctx['pipeline_id'], project_id=ctx['pid'])
executor = AgentExecutor(
config=config,
project_id=ctx['pid'],