feat: v0.3.0 re-release - add dashboard & sessions, hide pi option

- Usage dashboard: KPIs, model split, daily bars, year heatmap, recent requests
- Sessions management: list/preview/archive/delete with streaming preview
- Double-click daily bar opens per-model breakdown modal
- Paginated recent requests (30/page)
- Hide pi option from nav (kept code, just removed from UI)
- Timezone fixes: today/day_key/heatmap now use local calendar day
- Streaming preview with 20MB byte cap + 500-char frontend clip
- README attribution to kimicode-dashboard (MIT, JochenYang)
This commit is contained in:
KimiSwitch Dev committed 2026-07-28 09:16:21 +08:00
1 parent 139af18826
commit 32de98bff5
19 files changed
+3648 -35

No files matched your search

+108
View File
@@ -0,0 +1,108 @@
// Dashboard types — match the Rust structs in src-tauri/src/dashboard.rs (camelCase serde)
export interface TotalsRow {
requests: number;
inputOther: number;
output: number;
inputCacheRead: number;
inputCacheCreation: number;
costUsd: number;
totalTokens: number;
cacheHitRate: number;
}
export interface DailyRow extends TotalsRow {
date: string;
byModel: Record<string, number>;
}
export interface ModelRow extends TotalsRow {
model: string;
modelDisplay: string;
modelResolved: string;
priceId: string;
costEstimated: boolean;
}
export interface RecentRow {
time: number;
model: string;
modelDisplay: string;
modelResolved: string;
inputOther: number;
output: number;
inputCacheRead: number;
inputCacheCreation: number;
totalTokens: number;
costUsd: number;
costEstimated: boolean;
priceId: string;
fromEnv: boolean;
}
export interface RangeStats {
range: string;
totals: TotalsRow;
daily: DailyRow[];
models: ModelRow[];
recent: RecentRow[];
recentTotal: number;
recentLimit: number;
}
export interface HeatmapCell {
date: string;
dow: number;
weekIndex: number;
requests: number;
totalTokens: number;
costUsd: number;
cacheHitRate: number;
level: number;
}
export interface MonthLabel {
weekIndex: number;
label: string;
}
export interface HeatmapData {
weeks: number;
start: string;
end: string;
maxTokens: number;
cells: HeatmapCell[];
monthLabels: MonthLabel[];
}
export interface ScanMeta {
filesScanned: number;
linesSeen: number;
recordCount: number;
home: string;
sessionsRoot: string;
errors: string[];
}
export interface AllModelRow {
model: string;
modelDisplay: string;
requests: number;
totalTokens: number;
costUsd: number;
costEstimated: boolean;
cacheHitRate: number;
}
export interface SummaryResult {
home: string;
valid: boolean;
scannedAt: number;
meta: ScanMeta;
range: string;
stats: RangeStats;
heatmap: HeatmapData;
allModels: AllModelRow[];
allModelCount: number;
rangeTotals: Record<string, TotalsRow>;
}
+61
View File
@@ -0,0 +1,61 @@
// Session management types — match Rust structs in dashboard.rs (camelCase serde)
export interface WorkspaceRow {
id: string;
name: string;
root: string | null;
createdAt: string | null;
lastOpenedAt: string | null;
activeCount: number;
archivedCount: number;
empty: boolean;
}
export interface SessionRow {
id: string;
workspaceId: string;
status: "active" | "archived" | string;
title: string | null;
workDir: string | null;
createdAt: string | null;
updatedAt: string | null;
bytes: number;
files: number;
}
export interface SessionsResult {
home: string;
archiveRoot: string;
workspaces: WorkspaceRow[];
sessions: SessionRow[];
}
export interface ActionResponse {
ok: boolean;
workspaceId: string;
sessionId: string;
status?: string | null;
path?: string | null;
deleted?: boolean | null;
}
export interface PreviewMessage {
role: string;
time: number | null;
text: string;
}
export interface PreviewResult {
workspaceId: string;
sessionId: string;
status: string;
title: string | null;
workDir: string | null;
createdAt: string | null;
updatedAt: string | null;
messageCount: number;
truncated: boolean;
messages: PreviewMessage[];
}
export type SessionStatusFilter = "active" | "archived" | "all";