AI: warn when the selected Ollama model is not on the server
build / build (push) Successful in 16s
CI / compile (push) Successful in 6s
CI / unit (push) Successful in 22s
CI / integration (push) Successful in 1m38s

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:
2026-08-24 14:54:08 +02:00
committed by gitea
parent cfd19e2b34
commit fdc1fa1817
+11 -1
View File
@@ -284,7 +284,17 @@ class Events(commands.Cog):
others = await ai_functions.list_provider_models(nazwa_konfigu) others = await ai_functions.list_provider_models(nazwa_konfigu)
except ai_functions.AIError: except ai_functions.AIError:
others = [] 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 += ( message += (
f"\nDostępne modele: {', '.join(others)} " f"\nDostępne modele: {', '.join(others)} "
f"(`$gadaj_teraz {nazwa_konfigu} <model>`)." f"(`$gadaj_teraz {nazwa_konfigu} <model>`)."