- 范围新增 yesterday:本地时区昨日 0 点 ~ 今日 0 点,range_end 引入上界过滤 - RangeStats 新增 modelsByName:按裸模型名聚合,同一模型跨供应商合并, 子代理记录归入 __secondary__ 单独成行,按 Token 降序 - 趋势选项卡第 4 个 tab「模型用量统计」:新增 ModelTotalsChart 横向条形图, 悬停显示请求数/Token/缓存命中/费用 - 概览卡网格扩展为 5 张;i18n 中英同步 - 顺带:pricing 测试基准从已下架的 moonshotai/kimi-k2.5 切换到 kimi-k3
118 lines
2.6 KiB
TypeScript
118 lines
2.6 KiB
TypeScript
// 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;
|
|
/** Per-model structured breakdown (tokens / requests / cost / cacheHitRate). */
|
|
byModel: Record<string, TotalsRow>;
|
|
byProvider: Record<string, number>;
|
|
byProviderModel: Record<string, Record<string, number>>;
|
|
}
|
|
|
|
export interface ModelRow extends TotalsRow {
|
|
model: string;
|
|
modelDisplay: string;
|
|
modelResolved: string;
|
|
priceId: string;
|
|
costEstimated: boolean;
|
|
/** True when any record in this row came from a subagent (secondary-model) request. */
|
|
isSecondary: 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;
|
|
/** True when this request came from a subagent (secondary-model) call. */
|
|
isSecondary: boolean;
|
|
}
|
|
|
|
export interface RangeStats {
|
|
range: string;
|
|
totals: TotalsRow;
|
|
daily: DailyRow[];
|
|
models: ModelRow[];
|
|
/** Model totals keyed by bare model name — the same model across providers merges into one row. */
|
|
modelsByName: 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>;
|
|
}
|