fix: default missing remainingFraction to 1 instead of 0
Models without quota data (e.g. tab-completion models) were showing 0% because remainingFraction defaulted to 0 when absent. Now defaults to 1 so they show 100% remaining instead.
This commit is contained in:
@@ -703,8 +703,10 @@ async function getAntigravityUsage(accessToken, providerSpecificData) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const remainingFraction = toNumber(quotaInfo.remainingFraction, 0);
|
||||
const rawFraction = toNumber(quotaInfo.remainingFraction, -1);
|
||||
const resetAt = parseResetTime(quotaInfo.resetTime);
|
||||
// Default to 100% when the API doesn't report a fraction
|
||||
const remainingFraction = rawFraction < 0 ? 1 : rawFraction;
|
||||
// Models with no resetTime and full remaining are unlimited (e.g. tab-completion models)
|
||||
const isUnlimited = !resetAt && remainingFraction >= 1;
|
||||
const remainingPercentage = remainingFraction * 100;
|
||||
|
||||
Reference in New Issue
Block a user