新增 Codex Spark 额度展示

解析 GPT-5.3-Codex-Spark 额度窗口,并在号池页面和提供商账号抽屉中展示 Spark 周额度与 5H 额度。Spark 额度仅用于展示,不影响普通 Codex 周额度和 5H 额度的调度与筛选逻辑。
This commit is contained in:
Alice
2026-05-09 10:44:45 +08:00
parent fa22384f24
commit 757c264e3e
9 changed files with 394 additions and 19 deletions
@@ -29,10 +29,12 @@ describe('quota selectors', () => {
it('detects only depleted weekly segments', () => {
expect(hasNoWeeklyLimit('周剩余 0.0%(5天后重置) | 5H剩余 93.0%(2小时后重置)')).toBe(true)
expect(hasNoWeeklyLimit('周剩余 45.0%(5天后重置) | 5H剩余 0.0%(2小时后重置)')).toBe(false)
expect(hasNoWeeklyLimit('周剩余 45.0% | Spark周剩余 0.0%')).toBe(false)
})
it('detects only depleted 5h segments', () => {
expect(hasNoFiveHourLimit('周剩余 45.0%(5天后重置) | 5H剩余 0.0%(2小时后重置)')).toBe(true)
expect(hasNoFiveHourLimit('周剩余 0.0%(5天后重置) | 5H剩余 93.0%(2小时后重置)')).toBe(false)
expect(hasNoFiveHourLimit('5H剩余 93.0% | Spark5H剩余 0.0%')).toBe(false)
})
})
@@ -38,14 +38,20 @@ export function isDepletedQuotaSegment(segment: string): boolean {
return false
}
function isSparkQuotaSegment(segment: string): boolean {
return /spark/.test(segment)
}
export function hasNoFiveHourLimit(accountQuota: string | null | undefined): boolean {
return getQuotaSegments(accountQuota)
.filter((segment) => !isSparkQuotaSegment(segment))
.filter((segment) => /5h|5小时/.test(segment))
.some(isDepletedQuotaSegment)
}
export function hasNoWeeklyLimit(accountQuota: string | null | undefined): boolean {
return getQuotaSegments(accountQuota)
.filter((segment) => !isSparkQuotaSegment(segment))
.filter((segment) => /周|weekly|week/.test(segment))
.some(isDepletedQuotaSegment)
}