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}"