From fcaad763daa9ad9b5420a489b880b76599dc1cdb Mon Sep 17 00:00:00 2001 From: Folzo Date: Sun, 2 Aug 2026 09:53:29 +0200 Subject: [PATCH] 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 --- jean-router/app.py | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/jean-router/app.py b/jean-router/app.py index 6371f02..e30ed04 100644 --- a/jean-router/app.py +++ b/jean-router/app.py @@ -157,7 +157,7 @@ def jean_alive() -> bool: def jean_service_ok() -> bool: - """Verifie que le service Jean repond (HTTP)""" + """Verifie que le service Jean repond (HTTP) — silencieux""" try: r = requests.get(f"http://{JEAN_WEB_HOST}:{JEAN_WEB_PORT}/api/presets", timeout=3) return r.ok @@ -166,7 +166,7 @@ def jean_service_ok() -> bool: def ollama_service_ok() -> bool: - """Verifie que le service Ollama repond (HTTP)""" + """Verifie que le service Ollama repond (HTTP) — silencieux""" try: r = requests.get(f"http://{OLLAMA_DIRECT_HOST}:{OLLAMA_DIRECT_PORT}/api/version", timeout=2) return r.ok @@ -1019,31 +1019,30 @@ def dashboard_status(): jean_ok = jean_service_ok() if pc_alive else False olla_ok = ollama_service_ok() if pc_alive else False - try: - r = requests.get(f"http://{JEAN_WEB_HOST}:{JEAN_WEB_PORT}/api/presets", timeout=1) - presets_raw = r.json() if r.ok else [] - except Exception: - presets_raw = [] + # Presets depuis le cache (evite d'appeler get_presets qui log un warning si down) + presets_raw = presets_cache.get("data", []) if jean_ok else [] slot_info = None - try: - r = requests.get(f"http://{JEAN_WEB_HOST}:{JEAN_WEB_PORT}/slots", timeout=1) - if r.ok: - slots = r.json() - if slots: - s = slots[0] - slot_info = { - "processing": s.get("is_processing", False), - "id_task": s.get("id_task"), - "n_prompt_tokens": s.get("n_prompt_tokens", 0), - "n_decoded": s.get("next_token", [{}])[0].get("n_decoded", 0) if s.get("next_token") else 0, - } - except Exception: - pass + if jean_ok: + try: + r = requests.get(f"http://{JEAN_WEB_HOST}:{JEAN_WEB_PORT}/slots", timeout=1) + if r.ok: + slots = r.json() + if slots: + s = slots[0] + slot_info = { + "processing": s.get("is_processing", False), + "id_task": s.get("id_task"), + "n_prompt_tokens": s.get("n_prompt_tokens", 0), + "n_decoded": s.get("next_token", [{}])[0].get("n_decoded", 0) if s.get("next_token") else 0, + } + except Exception: + pass active = get_active_preset() with stats_lock: stats = dict(request_stats) + stats["last_requests"] = list(stats.get("last_requests", [])) return jsonify({ "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-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 .error{color:var(--red)} -#logs .warn{color:#f0883e;font-weight:500} +#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:#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 .debug{color:#484f58} #logs .highlight{color:var(--green);font-weight:700}