fix(pool): honor quota exhaustion toggle and default ignore to off

This commit is contained in:
elky
2026-10-10 10:04:41 +08:00
parent 29ba6c8cb1
commit 6bafef672f
8 changed files with 99 additions and 37 deletions
@@ -836,6 +836,7 @@ export interface PoolAdvancedConfig {
sticky_session_ttl_seconds?: number | null
load_threshold_percent?: number | null
skip_exhausted_accounts?: boolean | null
ignore_exhausted_accounts?: boolean | null
// Codex only: treat remaining quota <= 1% as exhausted (default false).
reserve_minimum_quota?: boolean
// 旧字段(兼容读取)
@@ -591,7 +591,7 @@ const form = ref({
account_self_check_concurrency: null as number | null | undefined,
auto_remove_banned_keys: false,
auto_remove_quota_exhausted_keys: false,
skip_exhausted_accounts: false,
ignore_exhausted_accounts: false,
})
interface ClaudeFormState {
@@ -630,8 +630,8 @@ function getHealthToggleValue(key: PoolHealthToggleKey): boolean {
return form.value.auto_remove_banned_keys
case 'auto_remove_quota_exhausted_keys':
return form.value.auto_remove_quota_exhausted_keys
case 'skip_exhausted_accounts':
return form.value.skip_exhausted_accounts
case 'ignore_exhausted_accounts':
return form.value.ignore_exhausted_accounts
}
}
@@ -649,8 +649,8 @@ function updateHealthToggleValue(key: PoolHealthToggleKey, value: boolean): void
case 'auto_remove_quota_exhausted_keys':
form.value.auto_remove_quota_exhausted_keys = value
return
case 'skip_exhausted_accounts':
form.value.skip_exhausted_accounts = value
case 'ignore_exhausted_accounts':
form.value.ignore_exhausted_accounts = value
}
}
@@ -686,7 +686,7 @@ watch([() => props.modelValue, () => props.providerId], ([open]) => {
account_self_check_concurrency: cfg?.account_self_check_concurrency ?? null,
auto_remove_banned_keys: cfg?.auto_remove_banned_keys ?? false,
auto_remove_quota_exhausted_keys: cfg?.auto_remove_quota_exhausted_keys ?? false,
skip_exhausted_accounts: cfg?.skip_exhausted_accounts ?? false,
ignore_exhausted_accounts: cfg?.ignore_exhausted_accounts ?? false,
}
const cc = props.currentClaudeConfig
@@ -754,7 +754,7 @@ async function handleSave() {
: undefined,
auto_remove_banned_keys: form.value.auto_remove_banned_keys,
auto_remove_quota_exhausted_keys: form.value.auto_remove_quota_exhausted_keys,
skip_exhausted_accounts: form.value.skip_exhausted_accounts,
ignore_exhausted_accounts: form.value.ignore_exhausted_accounts,
})
const payload: Parameters<typeof updateProvider>[1] = {
@@ -12,7 +12,7 @@ describe('poolAdvancedDialog', () => {
'account_self_check_enabled',
'auto_remove_banned_keys',
'auto_remove_quota_exhausted_keys',
'skip_exhausted_accounts',
'ignore_exhausted_accounts',
])
})
@@ -39,9 +39,9 @@ describe('poolAdvancedDialog', () => {
description: '探测到黑色“额度耗尽”账号后自动从号池移除。',
},
{
key: 'skip_exhausted_accounts',
label: '跳过额度耗尽账号',
description: '当 Codex / Kiro 账号额度已耗尽时,直接标记为不可调度并在请求侧跳过。',
key: 'ignore_exhausted_accounts',
label: '忽略额度耗尽',
description: '默认关闭,额度耗尽账号不参与调度。开启后忽略额度耗尽状态,仍保留封禁、冷却和最低额度保留等限制。',
},
])
})
@@ -3,7 +3,7 @@ export type PoolHealthToggleKey =
| 'account_self_check_enabled'
| 'auto_remove_banned_keys'
| 'auto_remove_quota_exhausted_keys'
| 'skip_exhausted_accounts'
| 'ignore_exhausted_accounts'
export interface PoolHealthToggleCard {
key: PoolHealthToggleKey
@@ -39,9 +39,9 @@ export function buildPoolHealthToggleCards(): PoolHealthToggleCard[] {
description: '探测到黑色“额度耗尽”账号后自动从号池移除。',
},
{
key: 'skip_exhausted_accounts',
label: '跳过额度耗尽账号',
description: '当 Codex / Kiro 账号额度已耗尽时,直接标记为不可调度并在请求侧跳过。',
key: 'ignore_exhausted_accounts',
label: '忽略额度耗尽',
description: '默认关闭,额度耗尽账号不参与调度。开启后忽略额度耗尽状态,仍保留封禁、冷却和最低额度保留等限制。',
},
]
}