spb/chat-spboucher-ai
Public
1import fs from "node:fs/promises";2import path from "node:path";3import { guarded, json } from "@/lib/api";4import { env } from "@/lib/env";56/** Serves the Phase Zero benchmark deliverables to the model laboratory. */7export const GET = guarded(async (req) => {8 const file = req.nextUrl.searchParams.get("file") ?? "capability-matrix.json";9 const allowed = ["capability-matrix.json", "benchmark-report.md", "routing-recommendations.md", "routing-recommendations.json", "model-discovery.json", "openai-results.json", "anthropic-results.json", "modality-results.json", "pricing.json"];10 if (!allowed.includes(file)) return json({ error: "fichier inconnu" }, { status: 400 });11 try {12 const data = await fs.readFile(path.join(env.BENCHMARKS_DIR, file), "utf8");13 return new Response(data, { headers: { "content-type": file.endsWith(".md") ? "text/markdown; charset=utf-8" : "application/json" } });14 } catch { return json({ error: "benchmark introuvable" }, { status: 404 }); }15});16