feat(platform_ability): apply_llm_config加能力分类硬校验——未登记能力拒绝落库(用户规则:先加分类再配模型,防LLM静默塞近似分类)

This commit is contained in:
yumoqing 2026-09-05 11:06:42 +08:00
parent 55ac0dbb40
commit 8de76e4a7b

View File

@ -316,6 +316,21 @@ async def _h_apply_llm_config(sor, params, ctx):
if not models:
return "spec.models 为空——文档里没有可配置的模型?"
# 能力分类校验2026-09-05 用户定夺的规则):模型能力必须是字典已登记的
# 分类不存在则拒绝落库——先加能力分类appcodes_kv llm_capability
# 含种子/提示词/端点注释四处同步),再配模型。防 LLM 静默塞进近似分类。
recs = await sor.sqlExe(
"SELECT k FROM appcodes_kv WHERE parentid='llm_capability'", {})
await sor.sqlExe("COMMIT", {})
known_caps = set(getattr(r, "k", "") for r in (recs or []))
unknown = sorted(set(
(m.get("capability") or "t2t").strip() for m in models) - known_caps)
if unknown:
return ("能力分类未登记,拒绝落库:%s。请先在能力分类字典"
"appcodes_kv parentid=llm_capability含种子数据/提取提示词/"
"模型列表端点注释同步)中添加该分类,再重新执行本工具。"
"现有分类:%s" % ("".join(unknown), "".join(sorted(known_caps))))
from appPublic.uniqueID import getID
# 1. 供应商:按名称复用