refactor(frontend): 优化 Gemini 配额显示,参考 Antigravity 样式

- 简化标签:将 "RPD Pro/Flash" 改为 "Pro/Flash",避免文字截断
- 添加账号类型徽章(Free/Pro/Ultra),带颜色区分
- 添加帮助图标(?),悬停显示限流政策和官方文档链接
- 重构显示布局:账号类型 + 两行配额(Pro/Flash)
- 移除冗余的 AccountQuotaInfo 组件调用
This commit is contained in:
IanShaw027
2026-01-01 08:29:57 +08:00
parent 4a7e2a44d9
commit 8181746695
8 changed files with 201 additions and 22 deletions

View File

@@ -202,22 +202,25 @@ func (s *AccountUsageService) GetUsage(ctx context.Context, accountID int64) (*U
func (s *AccountUsageService) getGeminiUsage(ctx context.Context, account *Account) (*UsageInfo, error) {
now := time.Now()
start := geminiDailyWindowStart(now)
stats, err := s.usageLogRepo.GetModelStatsWithFilters(ctx, start, now, 0, 0, account.ID)
if err != nil {
return nil, fmt.Errorf("get gemini usage stats failed: %w", err)
}
usage := &UsageInfo{
UpdatedAt: &now,
}
if s.geminiQuotaService == nil || s.usageLogRepo == nil {
return usage, nil
}
quota, ok := s.geminiQuotaService.QuotaForAccount(ctx, account)
if !ok {
return usage, nil
}
start := geminiDailyWindowStart(now)
stats, err := s.usageLogRepo.GetModelStatsWithFilters(ctx, start, now, 0, 0, account.ID)
if err != nil {
return nil, fmt.Errorf("get gemini usage stats failed: %w", err)
}
totals := geminiAggregateUsage(stats)
resetAt := geminiDailyResetTime(now)