import type { Metadata } from "next"; import { notFound } from "next/navigation"; import { RunMetaCard } from "@/components/run-meta"; import { endpointRunMeta, endpointSystem } from "@/lib/benchmark-meta"; import { kanameVersion } from "@/lib/benchmark-snapshot"; import { listBenchmarks } from "@/lib/benchmarks"; import { getEndpoint, listEndpoints } from "@/lib/endpoints"; import { BenchmarkList } from "../../benchmarks/benchmark-list"; import { BenchmarkStart } from "./benchmark-start"; import { EndpointHeader } from "./endpoint-header"; export const dynamic = "force-dynamic"; export async function generateMetadata({ params }: PageProps<"/endpoints/[id]">): Promise { const e = await getEndpoint((await params).id); return { title: e ? `${e.name} ยท Endpoint` : "Endpoint" }; } export default async function EndpointPage({ params }: PageProps<"/endpoints/[id]">) { const { id } = await params; const endpoint = await getEndpoint(id); if (!endpoint) notFound(); const [runs, all] = await Promise.all([listBenchmarks({ endpointId: id }), listEndpoints()]); const model = endpoint.model ?? (endpoint.probe?.models.length === 1 ? endpoint.probe.models[0] : null); // What a run would record now (the worker asks the server again when it starts). const preview = endpointRunMeta({ type: "endpoint", endpointName: endpoint.name, model: model ?? "(model)", engine: endpoint.engine ?? endpoint.probe?.engine ?? null, engineVersion: endpoint.probe?.engineVersion ?? null, contextSize: endpoint.probe?.contextSize ?? null, slots: endpoint.probe?.slots ?? null, hardware: endpoint.hardware, }); return (
e.id !== id).map((e) => ({ id: e.id, name: e.name, models: e.probe?.models ?? [], model: e.model }))} />
); }