Use nextResetTime for GLM remaining time
This commit is contained in:
16
dist/index.js
vendored
16
dist/index.js
vendored
@@ -84,10 +84,20 @@ async function getGlmUsage() {
|
|||||||
let totalMinutes = 0;
|
let totalMinutes = 0;
|
||||||
|
|
||||||
for (const l of limits) {
|
for (const l of limits) {
|
||||||
if (l.type === 'TOKENS_LIMIT') tokenPct = l.percentage || 0;
|
if (l.type === 'TOKENS_LIMIT') {
|
||||||
|
tokenPct = l.percentage || 0;
|
||||||
|
if (l.nextResetTime) {
|
||||||
|
const resetDate = new Date(l.nextResetTime);
|
||||||
|
const now = new Date();
|
||||||
|
timeRemaining = (resetDate - now) / 1000 / 60;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (l.type === 'TIME_LIMIT') {
|
if (l.type === 'TIME_LIMIT') {
|
||||||
timeRemaining = (l.remaining || 0) / 1000 / 60;
|
if (l.nextResetTime && timeRemaining === 0) {
|
||||||
totalMinutes = (l.total || 0) / 1000 / 60;
|
const resetDate = new Date(l.nextResetTime);
|
||||||
|
const now = new Date();
|
||||||
|
timeRemaining = (resetDate - now) / 1000 / 60;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user