mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-09 02:47:45 +08:00
feat(grok): add admin oauth and quota support
This commit is contained in:
@@ -39,4 +39,69 @@ describe('providerKeyQuota', () => {
|
||||
},
|
||||
}, 'codex')).toBe('周剩余 90.0% | 5H剩余 80.0% | Spark5H剩余 60.0% | Spark周剩余 95.0%')
|
||||
})
|
||||
|
||||
it('formats Grok account quota from structured quota windows', () => {
|
||||
expect(getQuotaDisplayText({
|
||||
status_snapshot: {
|
||||
oauth: {
|
||||
code: 'valid',
|
||||
},
|
||||
account: {
|
||||
code: 'ok',
|
||||
blocked: false,
|
||||
},
|
||||
quota: {
|
||||
provider_type: 'grok',
|
||||
code: 'ok',
|
||||
exhausted: false,
|
||||
windows: [
|
||||
{
|
||||
scope: 'account',
|
||||
used_value: 2,
|
||||
limit_value: 10,
|
||||
remaining_ratio: 0.8,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}, 'grok')).toBe('剩余 80.0% (8/10)')
|
||||
})
|
||||
|
||||
it('formats Grok mode quota from model-scoped windows', () => {
|
||||
expect(getQuotaDisplayText({
|
||||
status_snapshot: {
|
||||
oauth: {
|
||||
code: 'valid',
|
||||
},
|
||||
account: {
|
||||
code: 'ok',
|
||||
blocked: false,
|
||||
},
|
||||
quota: {
|
||||
provider_type: 'grok',
|
||||
code: 'ok',
|
||||
exhausted: false,
|
||||
plan_type: 'heavy',
|
||||
windows: [
|
||||
{
|
||||
code: 'model:quota_auto',
|
||||
label: 'auto',
|
||||
scope: 'model',
|
||||
remaining_ratio: 0.4,
|
||||
used_value: 90,
|
||||
limit_value: 150,
|
||||
},
|
||||
{
|
||||
code: 'model:quota_heavy',
|
||||
label: 'heavy',
|
||||
scope: 'model',
|
||||
remaining_ratio: 0,
|
||||
used_value: 20,
|
||||
limit_value: 20,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}, 'grok')).toBe('Auto剩余 40.0% (60/150) | Heavy剩余 0.0% (0/20)')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user