fix: logic reset quota by session

This commit is contained in:
2026-07-20 16:18:00 +07:00
parent 0e8a21fdbe
commit 580bf9d9ae
16 changed files with 340 additions and 87 deletions
@@ -36,8 +36,6 @@ function getQuotaTone(percentage) {
return { bar: "bg-red-500", dot: "bg-red-500", text: "text-red-500" };
}
const INACTIVE_SESSION_COUNTDOWN = "4h59m";
function TokenQuotaResetStatus({ quota }) {
const [now, setNow] = useState(() => new Date());
@@ -51,7 +49,7 @@ function TokenQuotaResetStatus({ quota }) {
const countdown = formatResetTime(quota.resetAt, now);
const isSession = quota.windowType === USER_TOKEN_LIMIT_WINDOWS.SESSION;
const text = countdown === "-"
? (isSession ? INACTIVE_SESSION_COUNTDOWN : "Reset time unavailable")
? (isSession ? "Session begins with the next request" : "Reset time unavailable")
: (isSession ? `Next tokens restore in ${countdown}` : `Resets in ${countdown}`);
return (