fix(platform): 提交模板复用查询排除query/download步骤模板(误选致提交打到查询path→404);base_url提取规则禁裸域

This commit is contained in:
yumoqing 2026-09-05 23:28:14 +08:00
parent 1dc55caf7f
commit c868b8854e

View File

@ -323,7 +323,7 @@ _EXTRACT_PROMPT = """你是大模型 API 配置专家。通读下面这份模型
只输出一个 JSON 对象不要 markdown 代码块字段
{
"vendor_name": "供应商名称",
"base_url": "API 基础地址(如 https://dashscope.aliyuncs.com/compatible-mode/v1",
"base_url": "API 基础地址——必须取文档示例请求 URL 中除接口路径外的完整前缀(含 /api/v1 或 /compatible-mode/v1 等路径段,如 https://dashscope.aliyuncs.com/api/v1。禁止只填裸域如 https://dashscope.aliyuncs.com——裸域拼接口路径必 404",
"protocol": "openai_compat | dashscope_async | custom能走 /chat/completions 的填 openai_compat",
"endpoints": [{"base_url": "...", "region": "domestic|international", "timeout": 60}],
"chat_path": "对话接口路径(如 /chat/completions",
@ -578,11 +578,15 @@ async def _h_apply_llm_config(sor, params, ctx):
tpl_notes = []
caps = sorted(set((m.get("capability") or "t2t") for m in models))
for cap in caps:
# 名称过滤必须加2026-09-05 e2e 实测 bug查询/下载步骤模板同库同协议
# 同能力,不加过滤会被「最新优先」误选为提交模板 → 提交打到查询 path → 404
recs = await sor.sqlExe(
"SELECT id, request_template, response_template FROM llm_api_profile "
"WHERE protocol=${p}$ AND capability=${c}$ AND status='active' "
"AND name NOT LIKE ${l1}$ AND name NOT LIKE ${l2}$ "
"ORDER BY created_at DESC LIMIT 1",
{"p": protocol, "c": cap})
{"p": protocol, "c": cap,
"l1": "%-query-%", "l2": "%-download-%"})
await sor.sqlExe("COMMIT", {})
if recs:
pid_old = getattr(recs[0], "id", "")