From 5826e43888774f482ec83fafe0f100a1967eb2b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E5=8F=8A?= <522caiji@gmail.com> Date: Sat, 26 Sep 2026 23:39:32 +0800 Subject: [PATCH] fix(codex): show usage windows and subscription plan The usage probe now reads the current rate_limit windows, so account cards stop sitting on "getting quota" and show the subscription tier. --- changelog/unreleased/codex-usage-windows.md | 7 +++ frontend/src/api/types.ts | 1 + .../src/components/account/QuotaMeter.tsx | 8 +++ frontend/src/i18n/messages.ts | 2 + frontend/src/lib/account.ts | 24 +++++++ internal/accounts/quota.go | 2 + internal/providers/codex/quota.go | 62 +++++++++++++------ internal/providers/codex/quota_test.go | 25 ++++++++ internal/providers/interfaces.go | 3 + internal/runtime/manager_quota.go | 4 ++ ...t-OPQEYEbm.js => TrafficChart-DVf_aibb.js} | 2 +- .../{index-oNlXVfto.js => index-CQrAj8e4.js} | 8 +-- internal/webui/static/index.html | 2 +- 13 files changed, 126 insertions(+), 24 deletions(-) create mode 100644 changelog/unreleased/codex-usage-windows.md rename internal/webui/static/assets/{TrafficChart-OPQEYEbm.js => TrafficChart-DVf_aibb.js} (99%) rename internal/webui/static/assets/{index-oNlXVfto.js => index-CQrAj8e4.js} (85%) diff --git a/changelog/unreleased/codex-usage-windows.md b/changelog/unreleased/codex-usage-windows.md new file mode 100644 index 0000000..b663345 --- /dev/null +++ b/changelog/unreleased/codex-usage-windows.md @@ -0,0 +1,7 @@ +### English + +- Codex account cards now read the current usage response, so the 5-hour and weekly windows show up instead of staying on "Getting quota…". The subscription tier from that response is shown above the windows. + +### 中文 + +- Codex 账号卡片现在按当前额度响应读取窗口,5 小时和每周额度会显示出来,不再一直停在「额度获取中…」。响应里的订阅等级会显示在额度窗口上方。 diff --git a/frontend/src/api/types.ts b/frontend/src/api/types.ts index 508c30f..94afe65 100644 --- a/frontend/src/api/types.ts +++ b/frontend/src/api/types.ts @@ -43,6 +43,7 @@ export type AccountQuota = { resource_package_unit?: string resource_package_available?: boolean fetched_at?: string + plan?: string } export type ModelInfo = { diff --git a/frontend/src/components/account/QuotaMeter.tsx b/frontend/src/components/account/QuotaMeter.tsx index 18764bc..6ee478c 100644 --- a/frontend/src/components/account/QuotaMeter.tsx +++ b/frontend/src/components/account/QuotaMeter.tsx @@ -1,6 +1,7 @@ import { Meter, Tooltip } from '@heroui/react' import type { AccountQuota, AccountQuotaWindow } from '@/api/types' import { + codexPlanLabel, formatQuotaAmount, quotaExpiryLabel, quotaResetLabel, @@ -100,6 +101,7 @@ export function QuotaMeter({ quota, t, label, usedLabel, remainingLabel, addOnLa const remaining = `${formatQuotaAmount(quota.remaining)}` const extra = extraQuotaLines(quota, remainingLabel, addOnLabel, resourcePackageLabel, t, provider) const windows = quotaWindows(quota) + const plan = provider === 'codex' ? codexPlanLabel(quota.plan) : '' const ratio = quotaUsedRatio(quota) const tone = quotaTone(quota) const color = tone === 'danger' ? 'danger' : tone === 'warn' ? 'warning' : 'success' @@ -108,6 +110,12 @@ export function QuotaMeter({ quota, t, label, usedLabel, remainingLabel, addOnLa if (windows.length > 0) { return (