feat(gemini): 完善 Gemini OAuth 配额系统和用量显示

主要改动:
- 后端:重构 Gemini 配额服务,支持多层级配额策略(GCP Standard/Free, Google One, AI Studio, Code Assist)
- 后端:优化 OAuth 服务,增强 tier_id 识别和存储逻辑
- 后端:改进用量统计服务,支持不同平台的配额查询
- 后端:优化限流服务,增加临时解除调度状态管理
- 前端:统一四种授权方式的用量显示格式和徽标样式
- 前端:增强账户配额信息展示,支持多种配额类型
- 前端:改进创建和重新授权模态框的用户体验
- 国际化:完善中英文配额相关文案
- 移除 CHANGELOG.md 文件

测试:所有单元测试通过
This commit is contained in:
IanShaw027
2026-01-04 15:36:00 +08:00
parent cc4cc806ea
commit a185ad1144
21 changed files with 1205 additions and 368 deletions

View File

@@ -322,8 +322,19 @@ export interface GeminiCredentials {
// OAuth authentication
access_token?: string
refresh_token?: string
oauth_type?: 'code_assist' | 'ai_studio' | string
tier_id?: 'LEGACY' | 'PRO' | 'ULTRA' | string
oauth_type?: 'code_assist' | 'google_one' | 'ai_studio' | string
tier_id?:
| 'google_one_free'
| 'google_ai_pro'
| 'google_ai_ultra'
| 'gcp_standard'
| 'gcp_enterprise'
| 'aistudio_free'
| 'aistudio_paid'
| 'LEGACY'
| 'PRO'
| 'ULTRA'
| string
project_id?: string
token_type?: string
scope?: string
@@ -397,6 +408,8 @@ export interface UsageProgress {
resets_at: string | null
remaining_seconds: number
window_stats?: WindowStats | null // 窗口期统计(从窗口开始到当前的使用量)
used_requests?: number
limit_requests?: number
}
// Antigravity 单个模型的配额信息
@@ -410,8 +423,12 @@ export interface AccountUsageInfo {
five_hour: UsageProgress | null
seven_day: UsageProgress | null
seven_day_sonnet: UsageProgress | null
gemini_shared_daily?: UsageProgress | null
gemini_pro_daily?: UsageProgress | null
gemini_flash_daily?: UsageProgress | null
gemini_shared_minute?: UsageProgress | null
gemini_pro_minute?: UsageProgress | null
gemini_flash_minute?: UsageProgress | null
antigravity_quota?: Record<string, AntigravityModelQuota> | null
}