From 0cf735018e91ed001d62508596459e4fe65c9f6d Mon Sep 17 00:00:00 2001 From: ymq Date: Sun, 6 Sep 2026 19:49:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(cockpit):=20=E4=BC=9A=E8=AF=9Dagent?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E9=80=89=E6=8B=A9=E6=94=B6=E7=AA=84=E4=B8=BA?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E8=83=BD=E5=8A=9Bt2t/i2t/m2t(2026-09-06?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=AE=9A=E5=A4=BA)=E2=80=94=E2=80=94?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E4=BC=A0capabilities=3Dchat,=E6=8C=81?= =?UTF-8?q?=E4=B9=85=E5=8C=96=E5=85=A5=E5=8F=A3(set=5Fagent=5Fmodel/cockpi?= =?UTF-8?q?t=5Fagent)=E5=90=8C=E5=AE=88=E5=8D=AB=E9=98=B2=E7=BB=95?= =?UTF-8?q?=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/api/cockpit_agent.dspy | 4 +++- wwwroot/api/cockpit_model_options.dspy | 4 +++- wwwroot/api/get_model_options.dspy | 4 +++- wwwroot/api/set_agent_model.dspy | 5 +++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/wwwroot/api/cockpit_agent.dspy b/wwwroot/api/cockpit_agent.dspy index 74a5204..bae7d08 100644 --- a/wwwroot/api/cockpit_agent.dspy +++ b/wwwroot/api/cockpit_agent.dspy @@ -27,8 +27,10 @@ if action == 'start_agent': # model_id 兼容 id / vendor_model_id / 注册名 → 统一走模型治理模块解析 # (pipeline_llm.selection.resolve_model_name,唯一解析点,不再各模块自查表) + # capabilities='chat':角色 agent 只接受对话能力(t2t/i2t/m2t,2026-09-06) if model_id: - _resolved = await llm_resolve_model_name(model_id, org_id=org_id) + _resolved = await llm_resolve_model_name(model_id, org_id=org_id, + capabilities='chat') if _resolved: model_id = _resolved diff --git a/wwwroot/api/cockpit_model_options.dspy b/wwwroot/api/cockpit_model_options.dspy index 30010a2..633f378 100644 --- a/wwwroot/api/cockpit_model_options.dspy +++ b/wwwroot/api/cockpit_model_options.dspy @@ -1,11 +1,13 @@ # cockpit_model_options.dspy — 驾驶舱模型下拉 # 2026-09-04 收敛:实现统一在模型治理模块 pipeline_llm.selection.model_options, # 本文件只作 URL 入口(驾驶舱 AgentIO 的 model_dataurl 指向此处)。 +# capabilities='chat':会话 agent 只列文本输出对话能力(t2t/i2t/m2t), +# 过滤掉 embedding/rerank/图视频生成等非对话模型(2026-09-06 用户定夺)。 uid = await get_user() org_id = (await get_userorgid()) or '' session_id = (params_kw or {}).get('session_id', '') or '' rows = await llm_model_options(org_id, uid=uid or '', session_id=session_id, - value_field='id') + value_field='id', capabilities='chat') return rows diff --git a/wwwroot/api/get_model_options.dspy b/wwwroot/api/get_model_options.dspy index b0ae4bb..5a1acaa 100644 --- a/wwwroot/api/get_model_options.dspy +++ b/wwwroot/api/get_model_options.dspy @@ -1,12 +1,14 @@ # get_model_options.dspy — 角色模型配置下拉(value=模型注册名) # 2026-09-04 收敛:实现统一在模型治理模块 pipeline_llm.selection.model_options, # 本文件只作 URL 入口。保留历史格式:首项「缺省(用项目默认模型)」+ value/text 两列。 +# capabilities='chat':角色模型也是会话/任务 agent 用的对话模型,只列 t2t/i2t/m2t +# (2026-09-06 用户定夺;防把 embedding 等非对话模型配给角色后推理链报能力不匹配)。 rows = [{'value': '', 'text': '缺省(用项目默认模型)'}] try: org_id = await get_userorgid() if org_id: - opts = await llm_model_options(org_id, value_field='name') + opts = await llm_model_options(org_id, value_field='name', capabilities='chat') rows += [{'value': r['value'], 'text': r['text']} for r in opts] return json.dumps(rows, ensure_ascii=False) except Exception as e: diff --git a/wwwroot/api/set_agent_model.dspy b/wwwroot/api/set_agent_model.dspy index 89f061a..174db69 100644 --- a/wwwroot/api/set_agent_model.dspy +++ b/wwwroot/api/set_agent_model.dspy @@ -15,9 +15,10 @@ if not llm_id: org_id = await get_userorgid() or '0' # 统一解析:解析得到注册名即代表存在且属于本机构(系统级不过滤) -name = await llm_resolve_model_name(llm_id, org_id=org_id) +# capabilities='chat':个人默认模型是会话 agent 用的,只接受对话能力(t2t/i2t/m2t) +name = await llm_resolve_model_name(llm_id, org_id=org_id, capabilities='chat') if not name: - return json.dumps({"success": False, "error": "模型不存在或不属于本机构"}, ensure_ascii=False) + return json.dumps({"success": False, "error": "模型不存在、不属于本机构或不是对话模型(t2t/i2t/m2t)"}, ensure_ascii=False) # 反查模型 id 持久化(个人默认选择按 id 存,与下拉 value 一致) _model_id = llm_id