feat(gemini): 优化 OAuth 和配额展示

主要改进:
- 修复 google_one OAuth scopes 配置问题
- 添加 Gemini 账号配额展示组件
- 优化 Code Assist 类型检测逻辑
- 添加 OAuth 测试用例
This commit is contained in:
ianshaw
2026-01-03 06:32:04 -08:00
parent 26438f7232
commit 26106eb0ac
11 changed files with 363 additions and 109 deletions

View File

@@ -19,7 +19,7 @@ export interface GeminiOAuthCapabilities {
export interface GeminiAuthUrlRequest {
proxy_id?: number
project_id?: string
oauth_type?: 'code_assist' | 'ai_studio'
oauth_type?: 'code_assist' | 'google_one' | 'ai_studio'
}
export interface GeminiExchangeCodeRequest {
@@ -27,10 +27,22 @@ export interface GeminiExchangeCodeRequest {
state: string
code: string
proxy_id?: number
oauth_type?: 'code_assist' | 'ai_studio'
oauth_type?: 'code_assist' | 'google_one' | 'ai_studio'
}
export type GeminiTokenInfo = Record<string, unknown>
export type GeminiTokenInfo = {
access_token?: string
refresh_token?: string
token_type?: string
scope?: string
expires_in?: number
expires_at?: number
project_id?: string
oauth_type?: string
tier_id?: string
extra?: Record<string, unknown>
[key: string]: unknown
}
export async function generateAuthUrl(
payload: GeminiAuthUrlRequest