mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
refactor: Antigravity/Codex 服务重构为插件化适配器架构
- 将 Antigravity 和 Codex 从独立模块迁移至 src/services/provider/adapters/ 插件体系 - 新增 provider_types 和 oauth_token 模块,移除 maintenance_scheduler 中的 OAuth 定时刷新 - 增强 admin API:扩展 keys 和 provider_query 端点,新增 dashboard 路由 - 大幅增强 ProviderDetailDrawer 组件,新增 AntigravityQuotaDialog - 改进 handler 基类(chat/cli)和错误分类器 - 优化 fetch_scheduler 和 upstream_fetcher - 前端 UI 组件清理和优化 - 更新测试以匹配新模块结构
This commit is contained in:
@@ -146,7 +146,15 @@ export async function updateProviderKey(
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新 Provider 的所有 Key 限额信息(Codex)
|
||||
* 清除 Key 的 OAuth 失效标记
|
||||
*/
|
||||
export async function clearOAuthInvalid(keyId: string): Promise<{ message: string }> {
|
||||
const response = await client.post(`/api/admin/endpoints/keys/${keyId}/clear-oauth-invalid`)
|
||||
return response.data
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新 Provider 的所有 Key 限额信息(Codex / Antigravity)
|
||||
*/
|
||||
export interface RefreshQuotaResult {
|
||||
success: number
|
||||
@@ -156,13 +164,8 @@ export interface RefreshQuotaResult {
|
||||
key_id: string
|
||||
key_name: string
|
||||
status: 'success' | 'no_metadata' | 'error'
|
||||
metadata?: {
|
||||
plan_type?: string
|
||||
primary_used_percent?: number
|
||||
primary_reset_seconds?: number
|
||||
secondary_used_percent?: number
|
||||
secondary_reset_seconds?: number
|
||||
}
|
||||
// Codex: 额度字段为扁平结构;Antigravity: 返回 { antigravity: { quota_by_model: ... } }
|
||||
metadata?: Record<string, any>
|
||||
message?: string
|
||||
status_code?: number
|
||||
}>
|
||||
|
||||
@@ -272,8 +272,8 @@ export interface EndpointAPIKey {
|
||||
oauth_account_id?: string | null // Codex ChatGPT 账号 ID
|
||||
oauth_invalid_at?: number | null // OAuth Token 失效时间(Unix 时间戳)
|
||||
oauth_invalid_reason?: string | null // OAuth Token 失效原因
|
||||
// 上游元数据(由响应头采集,如 Codex 额度信息)
|
||||
upstream_metadata?: CodexUpstreamMetadata | null
|
||||
// 上游元数据(由上游响应采集,如 Codex 额度信息 / Antigravity 配额信息)
|
||||
upstream_metadata?: UpstreamMetadata | null
|
||||
}
|
||||
|
||||
// Codex 上游元数据类型
|
||||
@@ -291,6 +291,21 @@ export interface CodexUpstreamMetadata {
|
||||
credits_balance?: number // 积分余额
|
||||
}
|
||||
|
||||
export interface AntigravityModelQuota {
|
||||
remaining_fraction: number // 剩余比例 (0.0-1.0)
|
||||
used_percent: number // 已用百分比 (0.0-100.0)
|
||||
reset_time?: string // RFC3339
|
||||
}
|
||||
|
||||
export interface AntigravityUpstreamMetadata {
|
||||
updated_at?: number // Unix 时间戳(秒)
|
||||
quota_by_model?: Record<string, AntigravityModelQuota>
|
||||
}
|
||||
|
||||
export interface UpstreamMetadata extends CodexUpstreamMetadata {
|
||||
antigravity?: AntigravityUpstreamMetadata
|
||||
}
|
||||
|
||||
// 按格式的健康度数据
|
||||
export interface FormatHealthData {
|
||||
health_score: number
|
||||
|
||||
Reference in New Issue
Block a user