fix: restore get_ollama_models() function body

The function was accidentally truncated when adding get_jean_context_lengths().
This caused TypeError: 'NoneType' object is not iterable in list_models().
This commit is contained in:
Folzo
2026-07-20 12:07:08 +02:00
parent afd340d8a4
commit 1670f57377
+13
View File
@@ -74,6 +74,19 @@ def get_ollama_models(force_refresh=False):
if not force_refresh and ollama_cache["data"] and (now - ollama_cache["timestamp"]) < CACHE_TTL:
return ollama_cache["data"]
try:
url = f"http://{OLLAMA_PROXY_HOST}:{OLLAMA_PROXY_PORT}/api/tags"
r = requests.get(url, timeout=3)
if r.ok:
data = r.json().get("models", [])
ollama_cache["data"] = data
ollama_cache["timestamp"] = now
return data
except Exception as e:
log.warning(f"[Ollama] Erreur récupération: {e}")
return ollama_cache["data"]
def get_jean_context_lengths():
"""Récupère les context_length depuis Jean /v1/models (avec cache)"""