mirror of
https://gitee.com/wanwujie/sub2api
synced 2026-04-12 10:54:45 +08:00
feat(usage): add group usage distribution chart alongside model distribution
- Add GroupStat type to usagestats package - Add GetGroupStatsWithFilters to UsageLogRepository interface and implement with LEFT JOIN groups - Add GetGroupStats dashboard API endpoint (GET /admin/dashboard/groups) - Add GroupDistributionChart.vue component mirroring ModelDistributionChart - Rearrange UsageView layout: model + group in one row, token trend full-width below - All filters (user, api_key, account, group, model, date range) apply to group stats
This commit is contained in:
@@ -78,6 +78,16 @@ type ModelStat struct {
|
||||
ActualCost float64 `json:"actual_cost"` // 实际扣除
|
||||
}
|
||||
|
||||
// GroupStat represents usage statistics for a single group
|
||||
type GroupStat struct {
|
||||
GroupID int64 `json:"group_id"`
|
||||
GroupName string `json:"group_name"`
|
||||
Requests int64 `json:"requests"`
|
||||
TotalTokens int64 `json:"total_tokens"`
|
||||
Cost float64 `json:"cost"` // 标准计费
|
||||
ActualCost float64 `json:"actual_cost"` // 实际扣除
|
||||
}
|
||||
|
||||
// UserUsageTrendPoint represents user usage trend data point
|
||||
type UserUsageTrendPoint struct {
|
||||
Date string `json:"date"`
|
||||
|
||||
Reference in New Issue
Block a user