mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
fix(pool): 修复 Codex 配额倒计时不准确 (#297)
* fix(pool): 修复 Codex 配额倒计时不准确 - 后端号池 keys payload 增加 upstream_metadata 透传 - 前端补充 PoolKeyDetail.upstream_metadata 与 Codex reset_after_seconds 类型 - 号池页倒计时优先使用 reset_at/reset_seconds/updated_at 结构化数据计算 - 仅在缺少结构化字段时回退 account_quota 文案解析 * fix(pool): 将已重置的 Codex 配额恢复为 100% - reset_after_seconds/reset_seconds 会按 updated_at 扣减经过时间(不再当作静态值) - 若窗口已重置(剩余秒数 <= 0),该窗口 used_percent 按 0 处理
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import client from '../client'
|
||||
import { dedupedRequest } from '@/utils/cache'
|
||||
import type { AllowedModels, OAuthOrganizationInfo, ProxyConfig } from './types/provider'
|
||||
import type {
|
||||
AllowedModels,
|
||||
OAuthOrganizationInfo,
|
||||
ProxyConfig,
|
||||
UpstreamMetadata,
|
||||
} from './types/provider'
|
||||
import type { ProviderKeyStatusSnapshot } from './types/statusSnapshot'
|
||||
|
||||
const POOL_BATCH_ACTION_TIMEOUT_MS = 5 * 60 * 1000
|
||||
@@ -114,6 +119,7 @@ export interface PoolKeyDetail {
|
||||
account_status_recoverable?: boolean // 兼容字段;优先使用 status_snapshot.account
|
||||
account_status_source?: string | null // 兼容字段;优先使用 status_snapshot.account
|
||||
status_snapshot?: ProviderKeyStatusSnapshot | null
|
||||
upstream_metadata?: UpstreamMetadata | null
|
||||
quota_updated_at?: number | null
|
||||
health_score?: number
|
||||
circuit_breaker_open?: boolean
|
||||
|
||||
@@ -307,10 +307,12 @@ export interface CodexUpstreamMetadata {
|
||||
plan_type?: string // 套餐类型
|
||||
primary_used_percent?: number // 周限额窗口使用百分比
|
||||
primary_reset_seconds?: number // 周限额重置剩余秒数
|
||||
primary_reset_after_seconds?: number // 周限额重置剩余秒数(兼容字段)
|
||||
primary_reset_at?: number // 周限额重置时间(Unix 时间戳)
|
||||
primary_window_minutes?: number // 周限额窗口大小(分钟)
|
||||
secondary_used_percent?: number // 5H限额窗口使用百分比
|
||||
secondary_reset_seconds?: number // 5H限额重置剩余秒数
|
||||
secondary_reset_after_seconds?: number // 5H限额重置剩余秒数(兼容字段)
|
||||
secondary_reset_at?: number // 5H限额重置时间(Unix 时间戳)
|
||||
secondary_window_minutes?: number // 5H限额窗口大小(分钟)
|
||||
has_credits?: boolean // 是否有积分
|
||||
|
||||
Reference in New Issue
Block a user