import { Activity } from "lucide-react" import { useTokenStats } from "@/lib/queries" import { useTokHistory } from "@/lib/metricsStore" import { LiveAreaChart, type ChartSeries } from "./LiveAreaChart" const SERIES: ChartSeries[] = [ { key: "prompt", label: "Prompt", color: "#f59e0b" }, { key: "completion", label: "Antwort", color: "#2dd4bf" }, ] export function TokenPerformanceCard() { const { data: ts } = useTokenStats(3_000) const hist = useTokHistory() // Durchsatz-Verlauf aus dem modul-globalen Store const last = hist[hist.length - 1] const curRate = last ? Math.round(last.prompt + last.completion) : 0 return (

Token-Durchsatz

live
{ts && (
{curRate.toLocaleString("de-DE")} tok/s aktuell
)} {ts && (
{ts.total_tokens.toLocaleString("de-DE")} Tokens gesamt · {ts.saved_eur.toLocaleString("de-DE", { minimumFractionDigits: 2 })} € gespart
Input {ts.prompt_tokens.toLocaleString("de-DE")} · Output {ts.completion_tokens.toLocaleString("de-DE")}
)}
{SERIES.map((s) => (
{s.label} {Math.round((last?.[s.key as "prompt" | "completion"]) ?? 0)}
))}
{ts ? ( ) : (
Lade Durchsatz…
)}
Durchsatz aus dem Gateway abgeleitet (Prefill vs. Generierung). Flach bei Leerlauf.
) }