feat(dashboard): add group usage distribution chart to usage page
Add a doughnut chart showing usage statistics broken down by group on the admin usage records page. The chart appears alongside the existing model distribution chart (2-column grid), with the token usage trend chart moved to a separate full-width row below. Changes: - backend/pkg/usagestats: add GroupStat type - backend/service: add GetGroupStatsWithFilters interface method and implementation - backend/repository: implement GetGroupStatsWithFilters with LEFT JOIN groups - backend/handler: add GetGroupStats handler with full filter support - backend/routes: register GET /admin/dashboard/groups route - backend/tests: add GetGroupStatsWithFilters stubs to contract/sora tests - frontend/types: add GroupStat interface - frontend/api: add getGroupStats API function and types - frontend/components: add GroupDistributionChart.vue doughnut chart - frontend/views: update UsageView layout and load group stats in parallel - frontend/i18n: add groupDistribution, group, noGroup keys (zh + en)
This commit is contained in:
@@ -1086,6 +1086,15 @@ export interface ModelStat {
|
||||
actual_cost: number // 实际扣除
|
||||
}
|
||||
|
||||
export interface GroupStat {
|
||||
group_id: number
|
||||
group_name: string
|
||||
requests: number
|
||||
total_tokens: number
|
||||
cost: number // 标准计费
|
||||
actual_cost: number // 实际扣除
|
||||
}
|
||||
|
||||
export interface UserUsageTrendPoint {
|
||||
date: string
|
||||
user_id: number
|
||||
|
||||
Reference in New Issue
Block a user