fix(llm): 协议匹配端点存在时只选匹配项(排除未标注)——防同账号多端点按序选到compatible-mode再404(自查发现)
This commit is contained in:
parent
51d1e4ccdd
commit
9f0691f0b7
@ -295,8 +295,14 @@ async def _pick_candidate(sor, model: dict, pref: str):
|
|||||||
matched = {i for i, e in tagged if (e.get('protocol') or '').strip() == mproto}
|
matched = {i for i, e in tagged if (e.get('protocol') or '').strip() == mproto}
|
||||||
untagged = {i for i, e in enumerate(endpoints)
|
untagged = {i for i, e in enumerate(endpoints)
|
||||||
if not (e.get('protocol') or '').strip()}
|
if not (e.get('protocol') or '').strip()}
|
||||||
usable = matched | untagged
|
# 有协议匹配端点 → 只选匹配的(同账号多端点余额同分,按序会选到
|
||||||
if not matched:
|
# 第一个即 compatible-mode → 404,必须排除不匹配项而非并集);
|
||||||
|
# 无匹配但有未标注(历史)端点 → 兜底用未标注;全无 → 报错
|
||||||
|
if matched:
|
||||||
|
usable = matched
|
||||||
|
elif untagged:
|
||||||
|
usable = untagged
|
||||||
|
else:
|
||||||
return False, ('供应商端点均为其他协议(模型模板协议 %s,端点协议 %s)——'
|
return False, ('供应商端点均为其他协议(模型模板协议 %s,端点协议 %s)——'
|
||||||
'原生异步(openai_compat 之外)与兼容模式端点 base_url 不同,'
|
'原生异步(openai_compat 之外)与兼容模式端点 base_url 不同,'
|
||||||
'混用必 404。请在供应商端点目录添加协议 %s 的端点'
|
'混用必 404。请在供应商端点目录添加协议 %s 的端点'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user