fix(platform): 裸域拦截提到回填打标之前——防裸域被打成协议匹配端点(自查发现)
This commit is contained in:
parent
d6228c59c6
commit
1dc55caf7f
@ -523,6 +523,17 @@ async def _h_apply_llm_config(sor, params, ctx):
|
|||||||
bu = (ep.get("base_url") or "").rstrip("/")
|
bu = (ep.get("base_url") or "").rstrip("/")
|
||||||
if not bu:
|
if not bu:
|
||||||
continue
|
continue
|
||||||
|
# 裸域退化拦截(新增与回填打标两条路径都要拦,2026-09-05 e2e 实测:
|
||||||
|
# 提取 LLM 偶发把 base_url 提成裸域,回填打标会让裸域变「协议匹配」
|
||||||
|
# 端点被运行时选中 → 拼出 https://host/services/... → 404)
|
||||||
|
pu = _urlparse(bu)
|
||||||
|
if not pu.path.strip("/"):
|
||||||
|
same_host = any(_urlparse((e.get("base_url") or "")).netloc == pu.netloc
|
||||||
|
and _urlparse((e.get("base_url") or "")).path.strip("/")
|
||||||
|
for e in merged)
|
||||||
|
if same_host:
|
||||||
|
skipped_eps.append("%s(裸域退化:同 host 已有带路径端点)" % bu)
|
||||||
|
continue
|
||||||
# 同 base_url 已存在:只补协议标签(旧端点无 protocol 时回填)
|
# 同 base_url 已存在:只补协议标签(旧端点无 protocol 时回填)
|
||||||
hit = None
|
hit = None
|
||||||
for e in merged:
|
for e in merged:
|
||||||
@ -533,14 +544,6 @@ async def _h_apply_llm_config(sor, params, ctx):
|
|||||||
if protocol and not hit.get("protocol"):
|
if protocol and not hit.get("protocol"):
|
||||||
hit["protocol"] = protocol
|
hit["protocol"] = protocol
|
||||||
continue
|
continue
|
||||||
# 裸域退化拦截:同 host 已有带路径端点 → 裸域跳过
|
|
||||||
pu = _urlparse(bu)
|
|
||||||
if not pu.path.strip("/"):
|
|
||||||
same_host = any(_urlparse((e.get("base_url") or "")).netloc == pu.netloc
|
|
||||||
for e in merged)
|
|
||||||
if same_host:
|
|
||||||
skipped_eps.append("%s(裸域退化:同 host 已有带路径端点)" % bu)
|
|
||||||
continue
|
|
||||||
merged.append({"base_url": bu, "region": ep.get("region") or "domestic",
|
merged.append({"base_url": bu, "region": ep.get("region") or "domestic",
|
||||||
"timeout": int(_f(ep.get("timeout"), 60)),
|
"timeout": int(_f(ep.get("timeout"), 60)),
|
||||||
"protocol": protocol})
|
"protocol": protocol})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user