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:
@@ -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:
|
if not force_refresh and ollama_cache["data"] and (now - ollama_cache["timestamp"]) < CACHE_TTL:
|
||||||
return ollama_cache["data"]
|
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():
|
def get_jean_context_lengths():
|
||||||
"""Récupère les context_length depuis Jean /v1/models (avec cache)"""
|
"""Récupère les context_length depuis Jean /v1/models (avec cache)"""
|
||||||
|
|||||||
Reference in New Issue
Block a user