From f0dbf134cdfae8f006517171ebb4ff2d8eb620a3 Mon Sep 17 00:00:00 2001 From: BLUE-coconut <1367012021@qq.com> Date: Thu, 9 Apr 2026 12:58:14 +0800 Subject: [PATCH] fix(quota): correct reversed used/remaining values in quiet mode The quiet mode (--quiet) in `quota show` was treating `current_interval_usage_count` as "used" and subtracting it from total to get "remaining". However, the API actually returns remaining/available counts in this field (consistent with the `model_remains` wrapper name). This caused the TSV output columns to be reversed: what was labeled as "remaining" was actually "used", and vice versa. The rich text table (quota-table.ts) already handled this correctly. Fixes #53 Co-Authored-By: Claude Opus 4.6 --- src/commands/quota/show.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/commands/quota/show.ts b/src/commands/quota/show.ts index 958ee71..5ac1a48 100644 --- a/src/commands/quota/show.ts +++ b/src/commands/quota/show.ts @@ -37,8 +37,9 @@ export default defineCommand({ if (config.quiet) { for (const m of models) { - const remaining = m.current_interval_total_count - m.current_interval_usage_count; - console.log(`${m.model_name}\t${m.current_interval_usage_count}\t${m.current_interval_total_count}\t${remaining}`); + const remaining = m.current_interval_usage_count; + const used = Math.max(0, m.current_interval_total_count - remaining); + console.log(`${m.model_name}\t${used}\t${m.current_interval_total_count}\t${remaining}`); } return; }