import type { BenchmarkEvaluationCardData } from "@/components/benchmark-evaluation-card" import type { BenchmarkCard, BenchmarkEvalListItem, BenchmarkEvalSummary, ModelEvaluationSummary, } from "@/lib/eval-processing" export interface DashboardDataResponse { models: BenchmarkEvaluationCardData[] evals: BenchmarkEvalListItem[] } export interface EvalListResponse { evals: BenchmarkEvalListItem[] totalModels: number } export interface DeveloperListItem { developer: string route_id: string model_count: number benchmark_count: number evaluation_count: number popular_evals: Array<{ benchmark: string model_count: number }> } export interface DeveloperSummaryResponse { developer: string route_id: string model_count: number benchmark_count: number evaluation_count: number popular_evals: Array<{ benchmark: string model_count: number }> models: BenchmarkEvaluationCardData[] } async function fetchJson(input: string): Promise { const response = await fetch(input) if (!response.ok) { throw new Error(`Request failed: ${response.status}`) } return response.json() as Promise } export function fetchDashboardData() { return fetchJson("/api/data") } export function fetchModelCards() { return fetchJson("/api/model-cards") } export function fetchEvalList() { return fetchJson("/api/eval-list") } export function fetchModelSummary(modelId: string) { return fetchJson( `/api/model-summary?id=${encodeURIComponent(modelId)}` ) } export function fetchEvalSummary(evalId: string) { return fetchJson( `/api/eval-summary?id=${encodeURIComponent(evalId)}` ) } export function fetchDevelopers() { return fetchJson("/api/developers") } export function fetchDeveloperSummary(developerId: string) { return fetchJson( `/api/developer-summary?id=${encodeURIComponent(developerId)}` ) } export function fetchBenchmarkMetadata() { return fetchJson>("/api/benchmark-metadata") }