fix: accurate quota reporting with project ID and improved rate limit handling
- Pass project ID to fetchAvailableModels for accurate per-project quota - Treat missing remainingFraction with resetTime as 0% (exhausted) - Fix double-escaped regex in rate-limit-parser.js (\\d -> \d) - Use ANTIGRAVITY_HEADERS for loadCodeAssist consistency - Store actual reset time from API instead of capping at default - Add getRateLimitInfo() for detailed rate limit state - Handle disabled accounts in rate limit checks Fixes issue where free tier accounts showed 100% quota but were actually exhausted. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,8 @@ import {
|
||||
resetAllRateLimits as resetLimits,
|
||||
markRateLimited as markLimited,
|
||||
markInvalid as markAccountInvalid,
|
||||
getMinWaitTimeMs as getMinWait
|
||||
getMinWaitTimeMs as getMinWait,
|
||||
getRateLimitInfo as getLimitInfo
|
||||
} from './rate-limits.js';
|
||||
import {
|
||||
getTokenForAccount as fetchToken,
|
||||
@@ -214,6 +215,16 @@ export class AccountManager {
|
||||
return getMinWait(this.#accounts, modelId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rate limit info for a specific account and model
|
||||
* @param {string} email - Email of the account
|
||||
* @param {string} modelId - Model ID to check
|
||||
* @returns {{isRateLimited: boolean, actualResetMs: number|null, waitMs: number}} Rate limit info
|
||||
*/
|
||||
getRateLimitInfo(email, modelId) {
|
||||
return getLimitInfo(this.#accounts, email, modelId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get OAuth token for an account
|
||||
* @param {Object} account - Account object with email and credentials
|
||||
|
||||
Reference in New Issue
Block a user