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:
Chris Staley
2026-03-31 17:23:27 -06:00
parent 89eb5b7eb9
commit 5083128774
+3 -1
View File
@@ -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;