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 <noreply@anthropic.com>
This commit was merged in pull request #25.
This commit is contained in:
+11
-1
@@ -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} <model>`)."
|
||||
)
|
||||
elif len(others) > 1:
|
||||
message += (
|
||||
f"\nDostępne modele: {', '.join(others)} "
|
||||
f"(`$gadaj_teraz {nazwa_konfigu} <model>`)."
|
||||
|
||||
Reference in New Issue
Block a user