fix: handle single data point in performance percentiles

This commit is contained in:
Abiba
2026-05-25 17:00:40 +00:00
parent f42747d721
commit 8c5c922a4e
+1 -1
View File
@@ -424,7 +424,7 @@ def performance():
return jsonify({"models": [], "reasons": [], "agents": [], "summary": {"total_requests": 0}}) return jsonify({"models": [], "reasons": [], "agents": [], "summary": {"total_requests": 0}})
def pct(values, p): def pct(values, p):
if not values: return 0 if len(values) < 2: return round(values[0], 1) if values else 0
return round(statistics.quantiles(sorted(values), n=100, method='inclusive')[min(p-1, 98)], 1) return round(statistics.quantiles(sorted(values), n=100, method='inclusive')[min(p-1, 98)], 1)
# Per-model stats # Per-model stats