feat(backend): keep the model resident and load it before it is asked

Ollama drops an idle model after five minutes by default, so the first
question after a pause pays the whole several-second load. Every chat request
now carries keep_alive (30 minutes by default) and POST /api/chat/warm loads
the weights on demand, letting a client wake the model while the user is
still writing. A warm-up that fails answers warmed=false instead of an error:
it is an optimisation, not a step the answer depends on.
This commit is contained in:
BlackAngelTV committed 2026-10-06 20:03:31 +02:00
1 parent 04f3236a7c
commit 60984e70ec
8 files changed
+285 -3

No files matched your search

+2
View File
@@ -25,4 +25,6 @@ RATE_LIMIT_WINDOW=60000
# OLLAMA_HOST est aussi accepté (variable standard de l'écosystème Ollama).
OLLAMA_URL=http://localhost:11434
OLLAMA_MODEL=qwen2.5:3b
# Durée pendant laquelle Ollama garde le modèle en mémoire après le dernier appel
OLLAMA_KEEP_ALIVE=30m
# JARVIS_SYSTEM_PROMPT=Tu es Jarvis...