From 763e84681fe592fcba5a647fa4be69d25c037bee Mon Sep 17 00:00:00 2001 From: ymq Date: Sun, 6 Sep 2026 19:49:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(gateway):=20=E9=A1=B9=E7=9B=AE=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E6=8C=81=E4=B9=85=E5=8C=96=E5=8A=A0=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E8=83=BD=E5=8A=9B=E5=AE=88=E5=8D=AB=E2=80=94=E2=80=94=E7=99=BD?= =?UTF-8?q?=E5=90=8D=E5=8D=95=E5=8F=96pipeline=5Fllm.selection.CHAT=5FCAPS?= =?UTF-8?q?(=E6=9C=AA=E8=A3=85=E5=85=9C=E5=BA=95t2t/i2t/m2t),=E9=9D=9E?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=A8=A1=E5=9E=8B=E9=80=89=E4=B8=AD=E5=8D=B3?= =?UTF-8?q?=E6=97=A0=E6=95=88=E8=B5=B0=E5=9B=9E=E9=80=80=E9=93=BE(2026-09-?= =?UTF-8?q?06=E7=94=A8=E6=88=B7=E5=AE=9A=E5=A4=BA)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_service/gateway.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pipeline_service/gateway.py b/pipeline_service/gateway.py index 1a99dc4..0c0fccd 100644 --- a/pipeline_service/gateway.py +++ b/pipeline_service/gateway.py @@ -226,10 +226,22 @@ class Gateway: except Exception: pass # 2026-09-04 切换到模型治理新表(旧 llm 表停用) + # 2026-09-06 会话 agent 只接受对话能力(t2t/i2t/m2t): + # 能力白名单唯一事实源 = pipeline_llm.selection.CHAT_CAPS + # (模块未装时兜底同值);存量 capability 空串按 t2t 语义归一; + # 非对话模型(embedding/视频生成等)选中即无效,走回退链, + # 不落项目 default_model + try: + from pipeline_llm.selection import CHAT_CAPS as _chat_caps + except ImportError: + _chat_caps = ("t2t", "i2t", "m2t") + _cap_ph = ",".join("${c%d}$" % i for i in range(len(_chat_caps))) + _cap_params = {"c%d" % i: c for i, c in enumerate(_chat_caps)} recs = await sor.sqlExe( "SELECT id, name, org_id FROM llm_model " - "WHERE status='active' AND (id=${m}$ OR vendor_model_id=${m}$) LIMIT 1", - {"m": model_id}) + "WHERE status='active' AND (id=${m}$ OR vendor_model_id=${m}$) " + "AND COALESCE(NULLIF(capability,''),'t2t') IN (%s) LIMIT 1" % _cap_ph, + dict({"m": model_id}, **_cap_params)) await sor.sqlExe("COMMIT", {}) if not recs: logger.warning(f"run_message: model_id 无效(不存在或未启用): {model_id}")