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 (