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
This commit is contained in:
+2
-13
@@ -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"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user