v3.11.7: fix MODELS dict crash in _auto_detect_vision_fallback

This commit is contained in:
Roman | RyzenAdvanced
2026-05-26 19:15:48 +04:00
Unverified
parent ddb5f3dddc
commit 0b13c376d8
2 changed files with 4 additions and 0 deletions

View File

@@ -868,6 +868,10 @@ def _auto_detect_vision_fallback(target_url, api_key, models):
chat_url = base + "/v1/chat/completions"
vision_model = ""
for m in (models or []):
if isinstance(m, dict):
m = m.get("name", m.get("id", str(m)))
if not isinstance(m, str):
continue
ml = m.lower()
if any(kw in ml for kw in _VISION_MODEL_KEYWORDS):
vision_model = m