aihezu 2.8.5 → 2.8.7
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/commands/usage.js +13 -9
- package/package.json +1 -1
package/commands/usage.js
CHANGED
|
@@ -434,9 +434,13 @@ function displayUsageStats(stats, origin, source) {
|
|
|
434
434
|
return l - c;
|
|
435
435
|
})();
|
|
436
436
|
|
|
437
|
-
//
|
|
438
|
-
const
|
|
439
|
-
|
|
437
|
+
// 提取日请求次数和 Token 用量(API 中 currentWindowRequests/Tokens 实际为日数据)
|
|
438
|
+
const currentDailyRequests = (stats.currentDailyRequests !== undefined) ? stats.currentDailyRequests
|
|
439
|
+
: (limits.currentDailyRequests !== undefined) ? limits.currentDailyRequests
|
|
440
|
+
: (stats.currentWindowRequests !== undefined) ? stats.currentWindowRequests : limits.currentWindowRequests;
|
|
441
|
+
const currentDailyTokens = (stats.currentDailyTokens !== undefined) ? stats.currentDailyTokens
|
|
442
|
+
: (limits.currentDailyTokens !== undefined) ? limits.currentDailyTokens
|
|
443
|
+
: (stats.currentWindowTokens !== undefined) ? stats.currentWindowTokens : limits.currentWindowTokens;
|
|
440
444
|
|
|
441
445
|
console.log(`域名: ${origin}`);
|
|
442
446
|
console.log(`来源: ${source}`);
|
|
@@ -448,6 +452,12 @@ function displayUsageStats(stats, origin, source) {
|
|
|
448
452
|
if (dailyRemaining !== null) {
|
|
449
453
|
console.log(`日剩余: ${formatCost(dailyRemaining)}`);
|
|
450
454
|
}
|
|
455
|
+
if (asNumber(currentDailyRequests) !== null || asNumber(currentDailyTokens) !== null) {
|
|
456
|
+
const parts = [];
|
|
457
|
+
if (asNumber(currentDailyRequests) !== null) parts.push(`请求 ${formatNumber(currentDailyRequests)} 次`);
|
|
458
|
+
if (asNumber(currentDailyTokens) !== null) parts.push(`Token ${formatCompactNumber(currentDailyTokens)}`);
|
|
459
|
+
console.log(`日统计: ${parts.join(' | ')}`);
|
|
460
|
+
}
|
|
451
461
|
|
|
452
462
|
console.log('');
|
|
453
463
|
console.log(
|
|
@@ -457,12 +467,6 @@ function displayUsageStats(stats, origin, source) {
|
|
|
457
467
|
if (windowRemaining !== null) {
|
|
458
468
|
console.log(`窗口剩余: ${formatCost(windowRemaining)}`);
|
|
459
469
|
}
|
|
460
|
-
if (asNumber(currentWindowRequests) !== null || asNumber(currentWindowTokens) !== null) {
|
|
461
|
-
const parts = [];
|
|
462
|
-
if (asNumber(currentWindowRequests) !== null) parts.push(`请求 ${formatNumber(currentWindowRequests)} 次`);
|
|
463
|
-
if (asNumber(currentWindowTokens) !== null) parts.push(`Token ${formatNumber(currentWindowTokens)}`);
|
|
464
|
-
console.log(`窗口统计: ${parts.join(' | ')}`);
|
|
465
|
-
}
|
|
466
470
|
const windowStartText = formatDateTime(windowStartTime);
|
|
467
471
|
const windowEndText = formatDateTime(windowEndTime);
|
|
468
472
|
if (windowStartText !== '-' || windowEndText !== '-') {
|