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.
25 lines
593 B
TypeScript
Vendored
25 lines
593 B
TypeScript
Vendored
import { api } from '@/lib/api'
|
|
import type { PerformanceMetricsData, PerfSummaryAllData } from './types'
|
|
|
|
export async function getPerfMetricsSummary(
|
|
hours = 24
|
|
): Promise<PerfSummaryAllData> {
|
|
const res = await api.get<PerfSummaryAllData>('/api/perf-metrics/summary', {
|
|
params: { hours },
|
|
})
|
|
return res.data
|
|
}
|
|
|
|
export async function getPerfMetrics(
|
|
modelName: string,
|
|
hours = 24
|
|
): Promise<PerformanceMetricsData> {
|
|
const res = await api.get<PerformanceMetricsData>('/api/perf-metrics', {
|
|
params: {
|
|
model: modelName,
|
|
hours,
|
|
},
|
|
})
|
|
return res.data
|
|
}
|