feat(platform): 自动配置去供应商protocol写入(模式归模型适配模板);dashscope_async纳入运行时协议(异步执行器已就位)

This commit is contained in:
yumoqing 2026-09-05 13:07:09 +08:00
parent 8de76e4a7b
commit 812f3fc6de

View File

@ -35,9 +35,11 @@ PLATFORM_PIPELINE_ID = "platform_general"
# 组织门禁:内部 agent 仅 owner 组织的角色可操作(任一 owner.* 角色,含通配)
OWNER_ORG = "owner"
# 当前运行时调用链支持的协议llm_bridge 固定 OpenAI 兼容路径)。
# 当前运行时调用链支持的协议(模式定义在模型的适配模板/执行器,非供应商):
# openai_compat —— 同步 chat/completions 一次往返
# dashscope_async —— 异步执行器:提交任务→轮询 query_profile_ids→取结果2026-09-05
# 其他协议的适配模板会存入 llm_api_profile 备查,但运行时暂不渲染。
RUNTIME_PROTOCOLS = ("openai_compat",)
RUNTIME_PROTOCOLS = ("openai_compat", "dashscope_async")
# ────────────────────── 权限门禁(代码层) ──────────────────────
@ -352,10 +354,10 @@ async def _h_apply_llm_config(sor, params, ctx):
merged.append({"base_url": bu, "region": ep.get("region") or "domestic",
"timeout": int(_f(ep.get("timeout"), 60))})
added_eps.append(bu)
# 2026-09-05供应商表不再有 protocol——请求形态由模型挂的适配模板决定
await sor.sqlExe(
"UPDATE llm_vendor SET endpoints=${e}$, protocol=${p}$, updated_at=NOW() "
"WHERE id=${i}$",
{"e": json.dumps(merged, ensure_ascii=False), "p": protocol, "i": vendor_id})
"UPDATE llm_vendor SET endpoints=${e}$, updated_at=NOW() WHERE id=${i}$",
{"e": json.dumps(merged, ensure_ascii=False), "i": vendor_id})
await sor.sqlExe("COMMIT", {})
vendor_action = "复用供应商 %s(新增端点 %d 个)" % (vendor_id, len(added_eps))
else:
@ -364,7 +366,7 @@ async def _h_apply_llm_config(sor, params, ctx):
"region": ep.get("region") or "domestic",
"timeout": int(_f(ep.get("timeout"), 60))} for ep in endpoints]
await sor.C("llm_vendor", {
"id": vendor_id, "name": vendor_name, "protocol": protocol,
"id": vendor_id, "name": vendor_name,
"endpoints": json.dumps(eps_norm, ensure_ascii=False),
"description": spec.get("doc_notes", "") or "",
"status": "active", "org_id": ctx.get("org_id", "") or "0"})