Model list: also filter embedding models out of the chat picker

This commit is contained in:
Inferencebot committed 2026-10-07 09:44:15 -06:00
1 parent 3d258e9a2d
commit 2a5277007e
1 file changed
+18 -6
+18 -6
View File
@@ -1828,13 +1828,15 @@ async def list_models(request: Request):
payload = r.json() payload = r.json()
# Chat-list filter: exclude audio-only models (STT/TTS). They are # Chat-list filter: exclude audio-only models (STT/TTS) and embedding
# registered and callable via /v1/audio/* for API users, but they are # models. They are registered and callable via their own routes
# not chat models — listing them in Open WebUI would just confuse # (/v1/audio/* and /v1/embeddings) for API users, but they are not chat
# members. The gateway's model_info carries `mode` for audio models; # models — listing them in Open WebUI would just confuse members. The
# fall back to a name check for safety. # gateway's model_info carries `mode` for these; fall back to a name
# check for safety.
audio_modes = {"audio_transcription", "audio_speech"} audio_modes = {"audio_transcription", "audio_speech"}
audio_name_hints = ("whisper", "voxtral", "tts") audio_name_hints = ("whisper", "voxtral", "tts")
embedding_name_hints = ("embed",)
def is_audio_model(m) -> bool: def is_audio_model(m) -> bool:
mode = ((m.get("info") or {}).get("meta") or {}).get("mode") or "" mode = ((m.get("info") or {}).get("meta") or {}).get("mode") or ""
@@ -1843,7 +1845,17 @@ async def list_models(request: Request):
mid = (m.get("id") or "").lower() mid = (m.get("id") or "").lower()
return any(h in mid for h in audio_name_hints) return any(h in mid for h in audio_name_hints)
payload["data"] = [m for m in payload.get("data", []) if not is_audio_model(m)] def is_embedding_model(m) -> bool:
mode = ((m.get("info") or {}).get("meta") or {}).get("mode") or ""
if mode == "embedding":
return True
mid = (m.get("id") or "").lower()
return any(h in mid for h in embedding_name_hints)
payload["data"] = [
m for m in payload.get("data", [])
if not is_audio_model(m) and not is_embedding_model(m)
]
for model in payload.get("data", []): for model in payload.get("data", []):
# Friendly display name: emoji value-tier + short name. The `id` # Friendly display name: emoji value-tier + short name. The `id`