fix(models): skip non-chat models when resolving chat defaults (#6907)

This commit is contained in:
red person
2026-10-31 13:49:26 +00:00
committed by GitHub
parent a797cee0b3
commit 9276db9c11
2 changed files with 90 additions and 3 deletions
+4 -3
View File
@@ -659,7 +659,7 @@ _NON_CHAT_CONTAINS = (
"gliner", "riva", "-parse", "-embedqa", "-nemoretriever",
"topic-control", "calibration",
"ai-synthetic-video", "cosmos-reason2",
"bge", "llama-guard",
"bge", "llama-guard", "-embed", "rerank",
)
_NON_CHAT_EXACT_PREFIXES = (
"gpt-audio", # gpt-audio, gpt-audio-mini etc. (not gpt-4o-audio-preview which is chat)
@@ -2846,11 +2846,12 @@ def setup_model_routes(model_discovery):
return {"endpoint_id": "", "endpoint_url": "", "model": ""}
base = _normalize_base(ep.base_url)
chat_url = build_chat_url(base)
if model and not _is_chat_model(model):
model = ""
if not model and (getattr(ep, "cached_models", None) or getattr(ep, "pinned_models", None)):
try:
visible = _visible_models(ep.cached_models, getattr(ep, "hidden_models", None), getattr(ep, "pinned_models", None))
if visible:
model = visible[0]
model = next((mid for mid in visible if _is_chat_model(mid)), "")
except Exception:
pass
return {"endpoint_id": ep.id, "endpoint_url": chat_url, "model": model}