fix(account): prevent quota-exceeded API key/Bedrock accounts from being scheduled

Add quota exceeded check to IsSchedulable() and refactor
shouldClearStickySession to delegate to IsSchedulable(), eliminating
duplicated logic and fixing missed overload/rate-limit/expired checks.
Frontend displays quota exceeded status independently via quota fields.
This commit is contained in:
erio
2026-04-19 18:45:04 +08:00
parent 51af8df31d
commit 258fd145ff
7 changed files with 207 additions and 35 deletions

View File

@@ -121,6 +121,9 @@ func (a *Account) IsSchedulable() bool {
if a.TempUnschedulableUntil != nil && now.Before(*a.TempUnschedulableUntil) {
return false
}
if a.IsAPIKeyOrBedrock() && a.IsQuotaExceeded() {
return false
}
return true
}