Spaces:
Runtime error
Runtime error
File size: 777 Bytes
cd8bd0a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import { NextRequest, NextResponse } from "next/server";
import { isAuthenticated } from "@/shared/utils/apiAuth";
import { getCompressionRunTelemetrySummary } from "@/lib/db/compressionRunTelemetry";
export const dynamic = "force-dynamic";
export async function GET(request: NextRequest) {
if (!(await isAuthenticated(request))) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
try {
const summary = getCompressionRunTelemetrySummary();
return NextResponse.json(summary);
} catch {
return NextResponse.json(
{
totalRuns: 0,
totalTokensSaved: 0,
runsWithStyles: 0,
bypassCount: 0,
totalOutputTokens: 0,
appliedStyleCounts: {},
},
{ status: 200 }
);
}
}
|