From 9f0691f0b73fd1fea96385f2e8720bff2c4eead9 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sat, 5 Sep 2026 23:11:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(llm):=20=E5=8D=8F=E8=AE=AE=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E7=AB=AF=E7=82=B9=E5=AD=98=E5=9C=A8=E6=97=B6=E5=8F=AA?= =?UTF-8?q?=E9=80=89=E5=8C=B9=E9=85=8D=E9=A1=B9(=E6=8E=92=E9=99=A4?= =?UTF-8?q?=E6=9C=AA=E6=A0=87=E6=B3=A8)=E2=80=94=E2=80=94=E9=98=B2?= =?UTF-8?q?=E5=90=8C=E8=B4=A6=E5=8F=B7=E5=A4=9A=E7=AB=AF=E7=82=B9=E6=8C=89?= =?UTF-8?q?=E5=BA=8F=E9=80=89=E5=88=B0compatible-mode=E5=86=8D404(?= =?UTF-8?q?=E8=87=AA=E6=9F=A5=E5=8F=91=E7=8E=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_llm/gateway.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pipeline_llm/gateway.py b/pipeline_llm/gateway.py index b0114d5..12c2afb 100644 --- a/pipeline_llm/gateway.py +++ b/pipeline_llm/gateway.py @@ -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} untagged = {i for i, e in enumerate(endpoints) 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)——' '原生异步(openai_compat 之外)与兼容模式端点 base_url 不同,' '混用必 404。请在供应商端点目录添加协议 %s 的端点'