✨ feat: Add model performance metrics to dashboard
Add a shared `performance-metrics` feature module for perf metric APIs, DTOs, and formatting, then surface global 24h model performance on the dashboard with cards and a top-model table. Reuse the shared metrics module from pricing model details, remove duplicated perf API/formatting code from pricing, and add localized labels for the new dashboard performance UI.
This commit is contained in:
-62
@@ -10,65 +10,3 @@ export async function getPricing(): Promise<PricingData> {
|
||||
const res = await api.get('/api/pricing')
|
||||
return res.data
|
||||
}
|
||||
|
||||
export type PerformanceSeriesPoint = {
|
||||
ts: number
|
||||
avg_ttft_ms: number
|
||||
avg_latency_ms: number
|
||||
success_rate: number
|
||||
avg_tps: number
|
||||
}
|
||||
|
||||
export type PerformanceGroup = {
|
||||
group: string
|
||||
avg_ttft_ms: number
|
||||
avg_latency_ms: number
|
||||
success_rate: number
|
||||
avg_tps: number
|
||||
series: PerformanceSeriesPoint[]
|
||||
}
|
||||
|
||||
export type PerformanceMetricsData = {
|
||||
success: boolean
|
||||
message?: string
|
||||
data: {
|
||||
model_name: string
|
||||
series_schema?: string
|
||||
groups: PerformanceGroup[]
|
||||
}
|
||||
}
|
||||
|
||||
export type PerfModelSummary = {
|
||||
model_name: string
|
||||
avg_latency_ms: number
|
||||
success_rate: number
|
||||
avg_tps: number
|
||||
request_count: number
|
||||
}
|
||||
|
||||
export type PerfSummaryAllData = {
|
||||
success: boolean
|
||||
message?: string
|
||||
data: {
|
||||
models: PerfModelSummary[]
|
||||
}
|
||||
}
|
||||
|
||||
export async function getPerfMetricsSummary(
|
||||
hours = 24
|
||||
): Promise<PerfSummaryAllData> {
|
||||
const res = await api.get(`/api/perf-metrics/summary?hours=${hours}`)
|
||||
return res.data
|
||||
}
|
||||
|
||||
export async function getPerfMetrics(
|
||||
modelName: string,
|
||||
hours = 24
|
||||
): Promise<PerformanceMetricsData> {
|
||||
const params = new URLSearchParams({
|
||||
model: modelName,
|
||||
hours: String(hours),
|
||||
})
|
||||
const res = await api.get(`/api/perf-metrics?${params.toString()}`)
|
||||
return res.data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user