dashboard: plus de spam [Presets] Erreur depuis le polling

- dashboard_status utilise le cache presets au lieu d'appeler Jean
- jean_service_ok/ollama_service_ok silencieux (pas de warning log)
- slot check uniquement si jean est UP
- [Presets] Erreur ne vient plus du dashboard mais d'OpenFox/OpenWebUI
This commit is contained in:
Folzo
2026-08-02 09:53:29 +02:00
parent e93ab95350
commit fcaad763da
+8 -9
View File
@@ -157,7 +157,7 @@ def jean_alive() -> bool:
def jean_service_ok() -> bool: def jean_service_ok() -> bool:
"""Verifie que le service Jean repond (HTTP)""" """Verifie que le service Jean repond (HTTP) — silencieux"""
try: try:
r = requests.get(f"http://{JEAN_WEB_HOST}:{JEAN_WEB_PORT}/api/presets", timeout=3) r = requests.get(f"http://{JEAN_WEB_HOST}:{JEAN_WEB_PORT}/api/presets", timeout=3)
return r.ok return r.ok
@@ -166,7 +166,7 @@ def jean_service_ok() -> bool:
def ollama_service_ok() -> bool: def ollama_service_ok() -> bool:
"""Verifie que le service Ollama repond (HTTP)""" """Verifie que le service Ollama repond (HTTP) — silencieux"""
try: try:
r = requests.get(f"http://{OLLAMA_DIRECT_HOST}:{OLLAMA_DIRECT_PORT}/api/version", timeout=2) r = requests.get(f"http://{OLLAMA_DIRECT_HOST}:{OLLAMA_DIRECT_PORT}/api/version", timeout=2)
return r.ok return r.ok
@@ -1019,13 +1019,11 @@ def dashboard_status():
jean_ok = jean_service_ok() if pc_alive else False jean_ok = jean_service_ok() if pc_alive else False
olla_ok = ollama_service_ok() if pc_alive else False olla_ok = ollama_service_ok() if pc_alive else False
try: # Presets depuis le cache (evite d'appeler get_presets qui log un warning si down)
r = requests.get(f"http://{JEAN_WEB_HOST}:{JEAN_WEB_PORT}/api/presets", timeout=1) presets_raw = presets_cache.get("data", []) if jean_ok else []
presets_raw = r.json() if r.ok else []
except Exception:
presets_raw = []
slot_info = None slot_info = None
if jean_ok:
try: try:
r = requests.get(f"http://{JEAN_WEB_HOST}:{JEAN_WEB_PORT}/slots", timeout=1) r = requests.get(f"http://{JEAN_WEB_HOST}:{JEAN_WEB_PORT}/slots", timeout=1)
if r.ok: if r.ok:
@@ -1044,6 +1042,7 @@ def dashboard_status():
active = get_active_preset() active = get_active_preset()
with stats_lock: with stats_lock:
stats = dict(request_stats) stats = dict(request_stats)
stats["last_requests"] = list(stats.get("last_requests", []))
return jsonify({ return jsonify({
"pc": { "pc": {
@@ -1154,8 +1153,8 @@ h1{font-size:18px;color:var(--purple);margin-bottom:12px}
.badge-red{background:#3a1a1a;color:var(--red);border:1px solid var(--red)} .badge-red{background:#3a1a1a;color:var(--red);border:1px solid var(--red)}
.badge-blue{background:#1a2a3a;color:var(--blue);border:1px solid var(--blue)} .badge-blue{background:#1a2a3a;color:var(--blue);border:1px solid var(--blue)}
#logs{grid-column:1/-1;height:400px;overflow-y:auto;font-size:12px;line-height:1.6;border:1px solid var(--border);border-radius:6px;padding:10px;background:#0a0e13} #logs{grid-column:1/-1;height:400px;overflow-y:auto;font-size:12px;line-height:1.6;border:1px solid var(--border);border-radius:6px;padding:10px;background:#0a0e13}
#logs .error{color:var(--red)} #logs .error{color:#ff7b72;background:#1a0a0a;padding:1px 4px;border-radius:3px;display:inline-block;max-width:100%;word-break:break-all}
#logs .warn{color:#f0883e;font-weight:500} #logs .warn{color:#ffa657;background:#1a1008;padding:1px 4px;border-radius:3px;display:inline-block;max-width:100%;word-break:break-all}
#logs .info{color:var(--muted)} #logs .info{color:var(--muted)}
#logs .debug{color:#484f58} #logs .debug{color:#484f58}
#logs .highlight{color:var(--green);font-weight:700} #logs .highlight{color:var(--green);font-weight:700}