From 92898a33e395ab8e71bd4508c1892961143cb6aa Mon Sep 17 00:00:00 2001 From: Homelab Cursor Date: Wed, 25 Mar 2026 19:46:35 +0100 Subject: [PATCH] fix(llm): kein Fallback auf Textmodell bei Vision-Anfragen Wenn qwen3-vl:32b timeout hat, wurde bisher auf qwen2.5:14b (Textmodell) zurueckgefallen. Das kann keine Bilder sehen und halluziniert stattdessen. Jetzt: allow_fallback=False fuer Vision und klare Fehlermeldung bei Timeout. --- homelab-ai-bot/llm.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/homelab-ai-bot/llm.py b/homelab-ai-bot/llm.py index 113f6825..b6355740 100644 --- a/homelab-ai-bot/llm.py +++ b/homelab-ai-bot/llm.py @@ -525,7 +525,8 @@ def ask_with_image(image_base64: str, caption: str, tool_handlers: dict, session try: for _round in range(MAX_TOOL_ROUNDS): data = _call_api(messages, api_key, use_tools=True, - model=MODEL_VISION, max_tokens=4000) + model=MODEL_VISION, max_tokens=4000, + allow_fallback=False) choice = data["choices"][0] msg = choice["message"] @@ -561,8 +562,14 @@ def ask_with_image(image_base64: str, caption: str, tool_handlers: dict, session }) data = _call_api(messages, api_key, use_tools=False, - model=MODEL_VISION, max_tokens=4000) + model=MODEL_VISION, max_tokens=4000, + allow_fallback=False) return data["choices"][0]["message"]["content"] + except requests.exceptions.ReadTimeout: + return ( + "Das Vision-Modell antwortet nicht (Timeout). " + "Bitte in 1-2 Min erneut versuchen — das Modell wird gerade geladen." + ) except Exception as e: return f"Vision-LLM-Fehler: {e}"