From a95655a245522a9d3b433f7fe3f7c2cb4424e99a Mon Sep 17 00:00:00 2001 From: CaIon Date: Wed, 17 Jun 2026 22:28:36 +0800 Subject: [PATCH] feat(performance): implement success rate grading and enhance UI representation --- .../models/performance-overview.tsx | 22 +- .../overview/performance-health-panel.tsx | 22 +- .../performance-metrics/lib/format.ts | 64 ++ .../pricing/components/model-details-api.tsx | 104 ---- .../components/model-details-capabilities.tsx | 181 ------ .../components/model-details-charts.tsx | 7 +- .../components/model-details-modalities.tsx | 160 ----- .../components/model-details-performance.tsx | 15 +- .../components/model-details-quick-stats.tsx | 147 ----- .../model-details-uptime-sparkline.tsx | 25 +- .../pricing/components/model-details.tsx | 439 +++++++++++--- .../pricing/components/model-perf-badge.tsx | 8 +- web/default/src/features/pricing/lib/index.ts | 1 - .../features/pricing/lib/model-metadata.ts | 569 ------------------ web/default/src/features/pricing/types.ts | 6 +- .../components/redemptions-mutate-drawer.tsx | 17 +- 16 files changed, 447 insertions(+), 1340 deletions(-) delete mode 100644 web/default/src/features/pricing/components/model-details-capabilities.tsx delete mode 100644 web/default/src/features/pricing/components/model-details-modalities.tsx delete mode 100644 web/default/src/features/pricing/components/model-details-quick-stats.tsx delete mode 100644 web/default/src/features/pricing/lib/model-metadata.ts diff --git a/web/default/src/features/dashboard/components/models/performance-overview.tsx b/web/default/src/features/dashboard/components/models/performance-overview.tsx index 5e67bb8a..f5f424ad 100644 --- a/web/default/src/features/dashboard/components/models/performance-overview.tsx +++ b/web/default/src/features/dashboard/components/models/performance-overview.tsx @@ -27,6 +27,8 @@ import { formatLatency, formatThroughput, formatUptimePct, + getSuccessRateDotClass, + getSuccessRateTextClass, } from '@/features/performance-metrics/lib/format' import type { PerfModelSummary } from '@/features/performance-metrics/types' @@ -79,20 +81,6 @@ function buildPerformanceSummary(rows: PerfModelSummary[]): PerformanceSummary { } } -function successRateClassName(successRate: number): string { - if (!Number.isFinite(successRate)) return 'text-muted-foreground' - if (successRate >= 99.9) return 'text-success' - if (successRate >= 99) return 'text-warning' - return 'text-destructive' -} - -function successDotClassName(successRate: number): string { - if (!Number.isFinite(successRate)) return 'bg-muted-foreground' - if (successRate >= 99.9) return 'bg-success' - if (successRate >= 99) return 'bg-warning' - return 'bg-destructive' -} - export function PerformanceOverview() { const { t } = useTranslation() const metricsQuery = useQuery({ @@ -152,7 +140,7 @@ export function PerformanceOverview() { icon={HeartPulse} label={t('Success rate')} value={formatUptimePct(summary.successRate)} - valueClassName={successRateClassName(summary.successRate)} + valueClassName={getSuccessRateTextClass(summary.successRate)} />