diff --git a/jean-router/app.py b/jean-router/app.py index 928a30b..3586e1c 100644 --- a/jean-router/app.py +++ b/jean-router/app.py @@ -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)"""