minimax-status 1.1.7 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/api.js +18 -0
- package/cli/index.js +10 -2
- package/cli/renderer.js +8 -1
- package/cli/status.js +15 -1
- package/package.json +1 -1
package/cli/api.js
CHANGED
|
@@ -302,6 +302,14 @@ class MinimaxAPI {
|
|
|
302
302
|
const hours = Math.floor(remainingMs / (1000 * 60 * 60));
|
|
303
303
|
const minutes = Math.floor((remainingMs % (1000 * 60 * 60)) / (1000 * 60));
|
|
304
304
|
|
|
305
|
+
// Calculate weekly usage data
|
|
306
|
+
const weeklyUsed = modelData.current_weekly_total_count - modelData.current_weekly_usage_count;
|
|
307
|
+
const weeklyTotal = modelData.current_weekly_total_count;
|
|
308
|
+
const weeklyPercentage = Math.floor((weeklyUsed / weeklyTotal) * 100);
|
|
309
|
+
const weeklyRemainingMs = modelData.weekly_remains_time;
|
|
310
|
+
const weeklyDays = Math.floor(weeklyRemainingMs / (1000 * 60 * 60 * 24));
|
|
311
|
+
const weeklyHours = Math.floor((weeklyRemainingMs % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
|
312
|
+
|
|
305
313
|
// Parse subscription expiry date if available
|
|
306
314
|
let expiryInfo = null;
|
|
307
315
|
if (
|
|
@@ -372,6 +380,16 @@ class MinimaxAPI {
|
|
|
372
380
|
total: modelData.current_interval_total_count,
|
|
373
381
|
percentage: usedPercentage,
|
|
374
382
|
},
|
|
383
|
+
weekly: {
|
|
384
|
+
used: weeklyUsed,
|
|
385
|
+
total: weeklyTotal,
|
|
386
|
+
percentage: weeklyPercentage,
|
|
387
|
+
days: weeklyDays,
|
|
388
|
+
hours: weeklyHours,
|
|
389
|
+
text: weeklyDays > 0
|
|
390
|
+
? `${weeklyDays} 天 ${weeklyHours} 小时后重置`
|
|
391
|
+
: `${weeklyHours} 小时后重置`,
|
|
392
|
+
},
|
|
375
393
|
contextWindow,
|
|
376
394
|
expiry: expiryInfo,
|
|
377
395
|
};
|
package/cli/index.js
CHANGED
|
@@ -374,6 +374,7 @@ program
|
|
|
374
374
|
usage,
|
|
375
375
|
remaining,
|
|
376
376
|
expiry,
|
|
377
|
+
weekly: usageData.weekly,
|
|
377
378
|
contextUsage: contextUsageValue,
|
|
378
379
|
contextSize: contextSizeValue,
|
|
379
380
|
configCounts,
|
|
@@ -565,13 +566,14 @@ program
|
|
|
565
566
|
} catch (e) {
|
|
566
567
|
usageData = {
|
|
567
568
|
usage: { percentage: 0, input: 0, output: 0, cached: 0, total: 0 },
|
|
569
|
+
weekly: null,
|
|
568
570
|
remaining: "未知",
|
|
569
571
|
expiry: "未知",
|
|
570
572
|
modelName: modelDisplayName
|
|
571
573
|
};
|
|
572
574
|
}
|
|
573
575
|
|
|
574
|
-
const { usage, remaining, expiry } = usageData;
|
|
576
|
+
const { usage, weekly, remaining, expiry } = usageData;
|
|
575
577
|
|
|
576
578
|
// 获取 git 分支
|
|
577
579
|
let gitBranch = null;
|
|
@@ -675,7 +677,13 @@ program
|
|
|
675
677
|
// 使用量 - 进度条风格 (显示次数)
|
|
676
678
|
const usageBar = coloredBar(usage.percentage);
|
|
677
679
|
const usageColor = usage.percentage >= 85 ? chalk.red : usage.percentage >= 60 ? chalk.yellow : chalk.green;
|
|
678
|
-
|
|
680
|
+
let usageLine = `${chalk.yellow('Usage')} ${usageBar} ${usageColor(usage.percentage + '%')} (${usage.remaining}/${usage.total})`;
|
|
681
|
+
// 周用量紧跟在 usage 后面
|
|
682
|
+
if (weekly) {
|
|
683
|
+
const weeklyColor = weekly.percentage >= 85 ? chalk.red : weekly.percentage >= 60 ? chalk.yellow : chalk.green;
|
|
684
|
+
usageLine += ` ${chalk.gray('·')} ${chalk.blue('W')} ${weeklyColor(weekly.percentage + '%')}`;
|
|
685
|
+
}
|
|
686
|
+
parts.push(usageLine);
|
|
679
687
|
|
|
680
688
|
// 倒计时
|
|
681
689
|
const remainingText = remaining.hours > 0
|
package/cli/renderer.js
CHANGED
|
@@ -70,6 +70,7 @@ class Renderer {
|
|
|
70
70
|
contextSize,
|
|
71
71
|
configCounts,
|
|
72
72
|
sessionDuration,
|
|
73
|
+
weekly,
|
|
73
74
|
} = data;
|
|
74
75
|
|
|
75
76
|
const parts = [];
|
|
@@ -122,7 +123,13 @@ class Renderer {
|
|
|
122
123
|
const filled = Math.round((usagePercentage / 100) * 10);
|
|
123
124
|
const empty = 10 - filled;
|
|
124
125
|
const usageBar = usageColor('█'.repeat(filled) + '\x1b[2m' + '░'.repeat(empty) + '\x1b[0m');
|
|
125
|
-
|
|
126
|
+
let usageLine = `${chalk.yellow('Usage')} ${usageBar} ${usageColor(usagePercentage + '%')} (${usage.remaining}/${usage.total})`;
|
|
127
|
+
// 周用量紧跟在 usage 后面
|
|
128
|
+
if (weekly) {
|
|
129
|
+
const weeklyColor = this.getStatusColor(weekly.percentage);
|
|
130
|
+
usageLine += ` ${chalk.gray('·')} ${chalk.blue('W')} ${weeklyColor(weekly.percentage + '%')}`;
|
|
131
|
+
}
|
|
132
|
+
parts.push(usageLine);
|
|
126
133
|
|
|
127
134
|
// 倒计时 - 保留图标
|
|
128
135
|
const remainingText = remaining.hours > 0
|
package/cli/status.js
CHANGED
|
@@ -74,7 +74,7 @@ class StatusBar {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
render() {
|
|
77
|
-
const { modelName, timeWindow, remaining, usage, expiry } = this.data;
|
|
77
|
+
const { modelName, timeWindow, remaining, usage, weekly, expiry } = this.data;
|
|
78
78
|
|
|
79
79
|
// Calculate progress bar width
|
|
80
80
|
const width = 30;
|
|
@@ -110,6 +110,20 @@ class StatusBar {
|
|
|
110
110
|
// 剩余次数
|
|
111
111
|
contentLines.push(`${chalk.dim(' 剩余:')} ${usage.remaining}/${usage.total} 次调用`);
|
|
112
112
|
|
|
113
|
+
// 周用量(如果有数据)
|
|
114
|
+
if (weekly) {
|
|
115
|
+
contentLines.push('');
|
|
116
|
+
const weeklyPercent = weekly.percentage;
|
|
117
|
+
const weeklyColor = weeklyPercent >= 85 ? chalk.red : weeklyPercent >= 60 ? chalk.yellow : chalk.green;
|
|
118
|
+
const weeklyProgress = this.createProgressBar(
|
|
119
|
+
Math.floor((weeklyPercent / 100) * 15),
|
|
120
|
+
15 - Math.floor((weeklyPercent / 100) * 15),
|
|
121
|
+
weeklyPercent
|
|
122
|
+
);
|
|
123
|
+
contentLines.push(`${chalk.cyan('周用量:')} ${weeklyColor(weeklyProgress)} ${weeklyColor(weekly.percentage + '%')} (${weekly.used}/${weekly.total})`);
|
|
124
|
+
contentLines.push(`${chalk.dim(' 重置:')} ${weekly.text}`);
|
|
125
|
+
}
|
|
126
|
+
|
|
113
127
|
// 添加到期行(如果可用)
|
|
114
128
|
if (expiry) {
|
|
115
129
|
const expiryText = `${expiry.date} (${expiry.text})`;
|