diff --git a/litellm_dashboard.py b/litellm_dashboard.py index c2e3184..1d89d92 100644 --- a/litellm_dashboard.py +++ b/litellm_dashboard.py @@ -310,7 +310,9 @@ class Tools: # Status — check for errors metadata = entry.get("metadata", {}) or {} exception = metadata.get("exception", "") - status = "❌ FAIL" if exception else "✅ OK" + status_flag = metadata.get("status", "") + is_failed = bool(exception) or status_flag == "failure" + status = "❌ FAIL" if is_failed else "✅ OK" # Duration duration_ms = entry.get("request_duration_ms", 0) or 0 @@ -358,9 +360,12 @@ class Tools: base += f" | ${spend:.4f}" # Error info - if exception: - # Truncate long error messages - err_short = exception[:80] + "…" if len(exception) > 80 else exception + if is_failed: + # Show exception if present, otherwise show status failure + if exception: + err_short = exception[:80] + "…" if len(exception) > 80 else exception + else: + err_short = "status: failure" base += f"\n └─ {err_short}" lines.append(base) @@ -371,7 +376,7 @@ class Tools: recent_prompt = sum(e.get("prompt_tokens", 0) or 0 for e in recent) recent_completion = sum(e.get("completion_tokens", 0) or 0 for e in recent) recent_cache = sum(e.get("cache_read_input_tokens", 0) or 0 for e in recent) - recent_failed = sum(1 for e in recent if (e.get("metadata", {}) or {}).get("exception")) + recent_failed = sum(1 for e in recent if ((e.get("metadata", {}) or {}).get("exception")) or ((e.get("metadata", {}) or {}).get("status", "")) == "failure") lines.append("") lines.append(f" Summary ({len(recent)} shown): ${recent_spend:.4f} spent | "