mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-04 16:37:46 +08:00
Merge remote-tracking branch 'origin/pr/558'
This commit is contained in:
@@ -3700,7 +3700,7 @@ function getQuotaProgressLabel(label: string): string {
|
||||
}
|
||||
|
||||
function getQuotaProgressCountdown(item: QuotaProgressItem) {
|
||||
if (!['日', '5H', '周', 'Spark5H', 'Spark周', 'Auto', 'Fast', 'Expert', 'Heavy', 'Grok 4.3'].includes(item.label)) return null
|
||||
if (!['日', '5H', '周', 'Spark5H', 'Spark周', 'Auto', 'Fast', 'Expert', 'Heavy', 'Grok 4.3', '生图'].includes(item.label)) return null
|
||||
if (item.resetAtSeconds == null && item.resetSeconds == null) return null
|
||||
return getCodexResetCountdown(
|
||||
item.resetAtSeconds,
|
||||
@@ -4109,10 +4109,10 @@ function buildQuotaProgressItemsFromSnapshot(key: PoolKeyDetail): QuotaProgressI
|
||||
const remainingValue = typeof window?.remaining_value === 'number' ? window.remaining_value : null
|
||||
const limitValue = typeof window?.limit_value === 'number' ? window.limit_value : null
|
||||
const usedValue = typeof window?.used_value === 'number' ? window.used_value : null
|
||||
const detail = usedValue != null && limitValue != null
|
||||
? `${formatQuotaValue(usedValue)}/${formatQuotaValue(limitValue)}`
|
||||
: remainingValue != null && limitValue != null
|
||||
? `${formatQuotaValue(Math.max(limitValue - remainingValue, 0))}/${formatQuotaValue(limitValue)}`
|
||||
const detail = remainingValue != null && limitValue != null
|
||||
? `${formatQuotaValue(remainingValue)}/${formatQuotaValue(limitValue)}`
|
||||
: usedValue != null && limitValue != null
|
||||
? `${formatQuotaValue(Math.max(limitValue - usedValue, 0))}/${formatQuotaValue(limitValue)}`
|
||||
: remainingValue != null
|
||||
? `剩余 ${formatQuotaValue(remainingValue)}`
|
||||
: undefined
|
||||
|
||||
@@ -643,6 +643,47 @@ describe('PoolManagement Codex cycle stats mode', () => {
|
||||
expect(root.querySelectorAll('button[title="查看评分计算结果"]').length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('shows ChatGPT Web image quota reset countdown above the quota bar', async () => {
|
||||
const chatgptWebKey = createPoolKey('chatgpt_web', {
|
||||
api_formats: ['openai:image'],
|
||||
status_snapshot: {
|
||||
oauth: { code: 'valid' },
|
||||
account: { code: 'ok', blocked: false },
|
||||
quota: {
|
||||
code: 'ok',
|
||||
exhausted: false,
|
||||
provider_type: 'chatgpt_web',
|
||||
updated_at: 1_700_000_000,
|
||||
windows: [
|
||||
{
|
||||
code: 'image_gen',
|
||||
label: '生图',
|
||||
scope: 'account',
|
||||
remaining_ratio: 0.96,
|
||||
remaining_value: 24,
|
||||
limit_value: 25,
|
||||
reset_seconds: 3600,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
})
|
||||
endpointMocks.getPoolOverview.mockResolvedValue({ items: [createOverview('chatgpt_web')] })
|
||||
endpointMocks.listPoolKeys.mockResolvedValue(createKeyPage(chatgptWebKey))
|
||||
endpointMocks.getProvider.mockResolvedValue(createProvider('chatgpt_web', {
|
||||
api_formats: ['openai:image'],
|
||||
}))
|
||||
|
||||
const root = mountPoolManagement()
|
||||
await settle()
|
||||
|
||||
const resetTexts = Array.from(root.querySelectorAll('[data-testid="pool-quota-reset-text"]'))
|
||||
.map((element) => element.textContent?.trim())
|
||||
.filter(Boolean)
|
||||
expect(resetTexts).toContain('1h')
|
||||
expect(root.textContent).toContain('生图')
|
||||
})
|
||||
|
||||
it('opens only one score popover across desktop and mobile layouts', async () => {
|
||||
const scoredKey = createPoolKey('codex', {
|
||||
pool_score: {
|
||||
|
||||
Reference in New Issue
Block a user