From 3279bb923d744ab316456f6a9688f36aa9b0b47e Mon Sep 17 00:00:00 2001 From: Polish Hammer Date: Mon, 24 Aug 2026 14:54:08 +0200 Subject: [PATCH] AI: warn when the selected Ollama model is not on the server Switching to a backend whose configured model the server does not have succeeded silently, and then every reply failed with "model not found" with nothing explaining why. The switch already fetches the model list to show what else is available, so use it: if the config's model is absent, say so and list what IS there. Found while probing the real server (192.168.1.72): it has exactly one model, gemma4:e2b, so the built-in llama3.1:8b default would have hit this on the first switch. Co-Authored-By: Claude Opus 4.8 --- ai_commands.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ai_commands.py b/ai_commands.py index fbec71a..50d28ce 100644 --- a/ai_commands.py +++ b/ai_commands.py @@ -284,7 +284,17 @@ class Events(commands.Cog): others = await ai_functions.list_provider_models(nazwa_konfigu) except ai_functions.AIError: others = [] - if len(others) > 1: + current = cfg.get("latest_model") + if others and current not in others: + # The configured/pinned model is not on the server: every + # reply would fail with "model not found" and nothing would + # say why. Flag it here, where the list is already in hand. + message += ( + f"\n⚠ Uwaga: '{current}' nie jest wgrany na serwerze. " + f"Dostępne: {', '.join(others)} " + f"(`$gadaj_teraz {nazwa_konfigu} `)." + ) + elif len(others) > 1: message += ( f"\nDostępne modele: {', '.join(others)} " f"(`$gadaj_teraz {nazwa_konfigu} `)."