feat: Token 仪表盘支持全局统计,跨会话累计 Token 分析

This commit is contained in:
Metona Dev
2026-04-24 12:53:50 +08:00
parent 08193c5d8e
commit 5fafaa691f
7 changed files with 467 additions and 29 deletions
+19
View File
@@ -438,6 +438,25 @@ export interface DBAPI {
clearAllSkills: () => Promise<{ success: boolean; error?: string }>;
searchSkills: (query: string, limit?: number) => Promise<unknown[]>;
incrementSkillUsage: (id: string, success: boolean, durationMs: number) => Promise<{ success: boolean; error?: string }>;
getAllTokenStats(): Promise<{
sessions: Array<{
session_id: string;
title: string;
model: string;
created_at: number;
total_input: number;
total_output: number;
total_duration: number;
round_count: number;
}>;
totals: {
total_input: number;
total_output: number;
total_duration: number;
total_rounds: number;
session_count: number;
};
} | null>;
}
// ── Window global 声明 ──