fix(models): validate_requested_model falls back to curated catalog when live API omits model
When live /v1/models responds but omits a model that exists in the curated static catalog, validate_requested_model now accepts it with a note instead of rejecting. This covers the /model slash-command path (the picker path was already fixed in the parent commit). Addresses review feedback from potatogim on #46857.
This commit is contained in:
@@ -3939,6 +3939,28 @@ def validate_requested_model(
|
||||
if suggestions:
|
||||
suggestion_text = "\n Similar models: " + ", ".join(f"`{s}`" for s in suggestions)
|
||||
|
||||
# Model not in live /v1/models — check the curated catalog
|
||||
# before rejecting. Providers may omit models from their live
|
||||
# listing that are still valid (stale cache, partial rollout,
|
||||
# gated previews). If the curated list has it, accept with a
|
||||
# note. (#46850)
|
||||
try:
|
||||
curated = provider_model_ids(normalized)
|
||||
except Exception:
|
||||
curated = []
|
||||
if curated:
|
||||
curated_lower = {m.lower(): m for m in curated}
|
||||
if requested_for_lookup.lower() in curated_lower:
|
||||
return {
|
||||
"accepted": True,
|
||||
"persist": True,
|
||||
"recognized": True,
|
||||
"message": (
|
||||
f"Note: `{requested}` was not found in the live /v1/models listing "
|
||||
f"but exists in the curated catalog — accepted."
|
||||
),
|
||||
}
|
||||
|
||||
return {
|
||||
"accepted": False,
|
||||
"persist": False,
|
||||
|
||||
Reference in New Issue
Block a user