From 2e83369483dfec4dbe61647f3d4e8f3958f9e796 Mon Sep 17 00:00:00 2001 From: Folzo Date: Mon, 20 Jul 2026 12:28:44 +0200 Subject: [PATCH] feat: add max_model_len field for OpenFox compatibility OpenFox looks for max_model_len in /v1/models response to determine context window size. This commit: - Adds max_model_len field to Jean models - Adds max_model_len field to Ollama models - Removes dead code after return statement --- jean-router/app.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/jean-router/app.py b/jean-router/app.py index 95ab418..b18ef28 100644 --- a/jean-router/app.py +++ b/jean-router/app.py @@ -119,19 +119,6 @@ def get_jean_context_lengths(): return jean_ctx_cache - 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_active_preset(): """Retourne le preset actuellement actif""" @@ -394,6 +381,7 @@ def list_models(): meta["context_length"] = ctx_len model_info["context_length"] = ctx_len model_info["context_window"] = ctx_len + model_info["max_model_len"] = ctx_len if meta: model_info["meta"] = meta @@ -430,6 +418,7 @@ def list_models(): meta["context_length"] = ctx_len model_info["context_length"] = ctx_len model_info["context_window"] = ctx_len + model_info["max_model_len"] = ctx_len if m.get("capabilities"): meta["capabilities"] = m["capabilities"]