fix(models): make pinned models visible in chat UI (#2481)
Two bugs prevented pinned models from appearing in the chat model picker: 1. _fetch_models() only used _cached_model_ids(), ignoring pinned_models. Since Fireworks AI doesn't list kimi-k2p6-turbo in /v1/models, the cached list was empty, so the endpoint showed as offline with no models. 2. _curate_models() filtered unknown pinned IDs into models_extra, but the chat UI only reads models (primary list). Pinned models stayed invisible. Fix: use _visible_models() to merge cached + pinned, then promote pinned IDs from models_extra to models so they appear in the dropdown. Closes #1521 follow-up
This commit is contained in:
@@ -1029,12 +1029,13 @@ def setup_model_routes(model_discovery):
|
||||
for ep in endpoints:
|
||||
base = _normalize_base(ep.base_url)
|
||||
provider = _detect_provider(base)
|
||||
# Use cached models — background refresh keeps them updated
|
||||
model_ids = _cached_model_ids(ep)
|
||||
# Merge cached + pinned models, then filter out hidden ones
|
||||
ep_model_type = getattr(ep, "model_type", None) or "llm"
|
||||
# Filter out hidden (probe-failed) models
|
||||
hidden = _hidden_model_ids(ep)
|
||||
model_ids = [m for m in model_ids if m not in hidden]
|
||||
model_ids = _visible_models(
|
||||
_cached_model_ids(ep),
|
||||
ep.hidden_models,
|
||||
getattr(ep, "pinned_models", None),
|
||||
)
|
||||
# Build correct URL based on provider
|
||||
chat_url = build_chat_url(base)
|
||||
kind = _effective_endpoint_kind(ep, base)
|
||||
@@ -1043,6 +1044,13 @@ def setup_model_routes(model_discovery):
|
||||
if model_ids:
|
||||
curated_key = _match_provider_curated(base, None)
|
||||
curated, extra = _curate_models(model_ids, curated_key)
|
||||
# Pinned models are admin-selected — they always belong in the
|
||||
# primary curated list, not buried in extras.
|
||||
pinned = _normalize_model_ids(getattr(ep, "pinned_models", None))
|
||||
for m in pinned:
|
||||
if m not in curated:
|
||||
curated.append(m)
|
||||
extra = [m for m in extra if m not in pinned]
|
||||
items.append({
|
||||
"host": "custom",
|
||||
"port": 0,
|
||||
|
||||
Reference in New Issue
Block a user