feat(gemini): 完善 Gemini OAuth 配额系统和用量显示
主要改动: - 后端:重构 Gemini 配额服务,支持多层级配额策略(GCP Standard/Free, Google One, AI Studio, Code Assist) - 后端:优化 OAuth 服务,增强 tier_id 识别和存储逻辑 - 后端:改进用量统计服务,支持不同平台的配额查询 - 后端:优化限流服务,增加临时解除调度状态管理 - 前端:统一四种授权方式的用量显示格式和徽标样式 - 前端:增强账户配额信息展示,支持多种配额类型 - 前端:改进创建和重新授权模态框的用户体验 - 国际化:完善中英文配额相关文案 - 移除 CHANGELOG.md 文件 测试:所有单元测试通过
This commit is contained in:
@@ -38,7 +38,8 @@ export function useGeminiOAuth() {
|
||||
const generateAuthUrl = async (
|
||||
proxyId: number | null | undefined,
|
||||
projectId?: string | null,
|
||||
oauthType?: string
|
||||
oauthType?: string,
|
||||
tierId?: string
|
||||
): Promise<boolean> => {
|
||||
loading.value = true
|
||||
authUrl.value = ''
|
||||
@@ -52,6 +53,8 @@ export function useGeminiOAuth() {
|
||||
const trimmedProjectID = projectId?.trim()
|
||||
if (trimmedProjectID) payload.project_id = trimmedProjectID
|
||||
if (oauthType) payload.oauth_type = oauthType
|
||||
const trimmedTierID = tierId?.trim()
|
||||
if (trimmedTierID) payload.tier_id = trimmedTierID
|
||||
|
||||
const response = await adminAPI.gemini.generateAuthUrl(payload as any)
|
||||
authUrl.value = response.auth_url
|
||||
@@ -73,6 +76,7 @@ export function useGeminiOAuth() {
|
||||
state: string
|
||||
proxyId?: number | null
|
||||
oauthType?: string
|
||||
tierId?: string
|
||||
}): Promise<GeminiTokenInfo | null> => {
|
||||
const code = params.code?.trim()
|
||||
if (!code || !params.sessionId || !params.state) {
|
||||
@@ -91,6 +95,8 @@ export function useGeminiOAuth() {
|
||||
}
|
||||
if (params.proxyId) payload.proxy_id = params.proxyId
|
||||
if (params.oauthType) payload.oauth_type = params.oauthType
|
||||
const trimmedTierID = params.tierId?.trim()
|
||||
if (trimmedTierID) payload.tier_id = trimmedTierID
|
||||
|
||||
const tokenInfo = await adminAPI.gemini.exchangeCode(payload as any)
|
||||
return tokenInfo as GeminiTokenInfo
|
||||
|
||||
Reference in New Issue
Block a user