fix: align usage analytics with Hermes state db (#350)

This commit is contained in:
Zhicheng Han
2026-04-30 13:46:31 +02:00
committed by GitHub
parent 05f15da90b
commit dac9006b3e
10 changed files with 591 additions and 113 deletions
+3 -3
View File
@@ -23,10 +23,10 @@ export const useUsageStore = defineStore('usage', () => {
const stats = ref<UsageStatsResponse | null>(null)
const isLoading = ref(false)
async function loadSessions() {
async function loadSessions(days = 30) {
isLoading.value = true
try {
stats.value = await fetchUsageStats()
stats.value = await fetchUsageStats(days)
} catch (err) {
console.error('Failed to load usage stats:', err)
} finally {
@@ -54,7 +54,7 @@ export const useUsageStore = defineStore('usage', () => {
const modelUsage = computed<ModelUsage[]>(() => {
if (!stats.value) return []
return stats.value.model_usage.map(m => ({
model: m.model,
model: m.model || 'unknown',
inputTokens: m.input_tokens,
outputTokens: m.output_tokens,
cacheTokens: m.cache_read_tokens,