feat: API analytics dashboard with i18n and theme support

Next.js full-stack analytics dashboard for new-api.
- Direct PostgreSQL readonly queries on logs table
- 5 pages: Dashboard, Rankings, Aggregation, Logs, Detail
- Dark/Light/System theme with CSS variables
- Chinese/English i18n (default Chinese)
- Recharts with dual Y-axis for input/output tokens
- Lucide icons + Motion animations
- Docker + docker-compose with external sinobridge network, port 8019
This commit is contained in:
2026-04-02 12:47:50 +08:00
commit b719b358f8
41 changed files with 3430 additions and 0 deletions

19
app/api/logs/route.ts Normal file
View File

@@ -0,0 +1,19 @@
import { NextRequest, NextResponse } from "next/server";
import { getLogs } from "@/lib/queries";
export async function GET(req: NextRequest) {
const sp = req.nextUrl.searchParams;
const data = await getLogs({
page: sp.get("page") ? Number(sp.get("page")) : 1,
pageSize: sp.get("page_size") ? Number(sp.get("page_size")) : 100,
startTs: sp.get("start") ? Number(sp.get("start")) : undefined,
endTs: sp.get("end") ? Number(sp.get("end")) : undefined,
username: sp.get("username") || undefined,
model: sp.get("model") || undefined,
channelId: sp.get("channel_id") ? Number(sp.get("channel_id")) : undefined,
tokenName: sp.get("token_name") || undefined,
});
return NextResponse.json(data);
}