mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
refactor: unify token usage stats across all session types (#274)
- Rewrite SQL queries to join bot_history_messages with bot_sessions, supporting chat/heartbeat/schedule usage from a single source - Update Go handler and CLI command to use unified queries - Fix daily chart stacking: each session type gets its own bar group - Add total input/output trend lines to the daily token chart - Fix summary cards reactivity by restricting aggregation to allDays range - Fix cache chart reactive dependency tracking by inlining data access - Add i18n keys for schedule, totalInput, totalOutput - Default time range changed to 7 days - Regenerate sqlc, swagger, and SDK
This commit is contained in:
+9
-1
@@ -4676,7 +4676,7 @@
|
||||
},
|
||||
"/bots/{bot_id}/token-usage": {
|
||||
"get": {
|
||||
"description": "Get daily aggregated token usage for a bot, split by chat and heartbeat, with optional model filter and per-model breakdown",
|
||||
"description": "Get daily aggregated token usage for a bot, split by chat, heartbeat, and schedule session types, with optional model filter and per-model breakdown",
|
||||
"tags": [
|
||||
"token-usage"
|
||||
],
|
||||
@@ -11183,6 +11183,12 @@
|
||||
"items": {
|
||||
"$ref": "#/definitions/handlers.DailyTokenUsage"
|
||||
}
|
||||
},
|
||||
"schedule": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/handlers.DailyTokenUsage"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -11909,11 +11915,13 @@
|
||||
"enum": [
|
||||
"ok",
|
||||
"auth_error",
|
||||
"model_not_supported",
|
||||
"error"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"TestStatusOK",
|
||||
"TestStatusAuthError",
|
||||
"TestStatusModelNotSupported",
|
||||
"TestStatusError"
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user