Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): 金额展示去掉 ≈ 前缀,充值弹窗移除「取消支付」按钮 (#458)
GaoWei Liuaff7009e98c4
diff --git a/apps/desktop/src/renderer/__tests__/usageFormat.test.ts b/apps/desktop/src/renderer/__tests__/usageFormat.test.tsindex da66d9b1a8..da730078ca 100644--- a/apps/desktop/src/renderer/__tests__/usageFormat.test.ts+++ b/apps/desktop/src/renderer/__tests__/usageFormat.test.ts@@ -35,6 +35,6 @@ describe('formatTurnCostMoney', () => {approximate: true,kind: 'value-estimate',}),- ).toBe('≈$0.00');+ ).toBe('$0.00');});});diff --git a/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx b/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsxindex 2d97c62c8d..8e4e409a52 100644--- a/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx+++ b/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx@@ -1037,7 +1037,6 @@ function ModelSelectorContentView({</span><span className="flex items-center justify-end gap-1.5 tabular-nums"><span className="text-[var(--model-item-text)]">- {editingPricePresentation.current.approximate ? '≈' : ''}{row.value}</span>{row.originalValue && (diff --git a/apps/desktop/src/renderer/components/new-chat/UsageDailyBars.tsx b/apps/desktop/src/renderer/components/new-chat/UsageDailyBars.tsxindex 78b9109e28..0607cf7bf8 100644--- a/apps/desktop/src/renderer/components/new-chat/UsageDailyBars.tsx+++ b/apps/desktop/src/renderer/components/new-chat/UsageDailyBars.tsx@@ -60,7 +60,7 @@ interface DayBar {* 纯 Codex 订阅日 costUsd 为 0, 仍按估算分段撑起柱子。*/effectiveAmount: number;- /** 总额包含 Codex 订阅价值估算 → 总额前缀 ≈ 并展示 tooltip 解释。 */+ /** 总额包含 Codex 订阅价值估算 → tooltip 展示估算解释。 */approximate: boolean;}diff --git a/apps/desktop/src/renderer/features/billing/BillingCheckoutDialog.tsx b/apps/desktop/src/renderer/features/billing/BillingCheckoutDialog.tsxindex 92a1a0a9cd..dd4448da48 100644--- a/apps/desktop/src/renderer/features/billing/BillingCheckoutDialog.tsx+++ b/apps/desktop/src/renderer/features/billing/BillingCheckoutDialog.tsx@@ -14,7 +14,6 @@ interface BillingCheckoutDialogProps {onClose: () => void;onRefresh: () => void;onRetry: () => void;- onCancel: () => void;}function actionOf(state: BillingCheckoutState) {@@ -26,7 +25,6 @@ export function BillingCheckoutDialog({onClose,onRefresh,onRetry,- onCancel,}: BillingCheckoutDialogProps) {const { t } = useTranslation();const action = actionOf(state);@@ -85,10 +83,6 @@ export function BillingCheckoutDialog({(state.error && state.intent !== null && state.order === null && state.subscription === null) ||(state.kind === 'TOPUP' &&(state.order?.status === 'FAILED' || state.order?.status === 'EXPIRED'));- const canCancel =- state.kind === 'TOPUP' &&- state.order !== null &&- (state.order.status === 'CREATED' || state.order.status === 'PENDING');return (<Dialog.Root@@ -220,18 +214,7 @@ export function BillingCheckoutDialog({)}</div>- <div className="flex min-h-16 items-center justify-between gap-3 border-t border-[var(--border-default)] px-6 py-3">- <div>- {canCancel && (- <button- type="button"- onClick={onCancel}- className="h-9 rounded-full px-3 text-12 text-[var(--text-secondary)] transition-colors hover:bg-[var(--surface-hover-soft)]"- >- {t('billing.actions.cancelPayment')}- </button>- )}- </div>+ <div className="flex min-h-16 items-center justify-end gap-3 border-t border-[var(--border-default)] px-6 py-3"><div className="flex items-center gap-2">{state.phase === 'AWAITING_PAYMENT' && (<buttondiff --git a/apps/desktop/src/renderer/features/billing/BillingPage.tsx b/apps/desktop/src/renderer/features/billing/BillingPage.tsxindex ec8e04629f..901cc52617 100644--- a/apps/desktop/src/renderer/features/billing/BillingPage.tsx+++ b/apps/desktop/src/renderer/features/billing/BillingPage.tsx@@ -860,7 +860,6 @@ export function BillingSettingsSection({ accountId }: { accountId: string | nullonClose={checkout.close}onRefresh={() => void checkout.refreshActive()}onRetry={() => void checkout.retry()}- onCancel={() => void checkout.cancel()}/><PlanChangeTargetDialogdiff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex 386844da93..03c2ba4c98 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -7247,7 +7247,6 @@"retry": "Retry","pay": "Review and pay","refresh": "Refresh status",- "cancelPayment": "Cancel payment","close": "Close"},"catalog": {diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex 465d9610bd..5def3fb85e 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -7236,7 +7236,6 @@"retry": "再試行","pay": "確認して支払う","refresh": "状態を更新",- "cancelPayment": "支払いをキャンセル","close": "閉じる"},"catalog": {diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex d21649a8ee..8a214b56fb 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -7236,7 +7236,6 @@"retry": "다시 시도","pay": "확인 및 결제","refresh": "상태 새로고침",- "cancelPayment": "결제 취소","close": "닫기"},"catalog": {diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex 5a832295fd..ba95ce8a57 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -7236,7 +7236,6 @@"retry": "重试","pay": "确认并支付","refresh": "刷新状态",- "cancelPayment": "取消支付","close": "关闭"},"catalog": {diff --git a/apps/desktop/src/renderer/lib/__tests__/modelPriceFormat.test.ts b/apps/desktop/src/renderer/lib/__tests__/modelPriceFormat.test.tsindex 093538675b..fd33cebaee 100644--- a/apps/desktop/src/renderer/lib/__tests__/modelPriceFormat.test.ts+++ b/apps/desktop/src/renderer/lib/__tests__/modelPriceFormat.test.ts@@ -26,7 +26,7 @@ describe('modelPriceFormat', () => {expect(formatModelPricePair(quote())).toBe('¥3 / ¥15');});- it('adds the approximate marker only once', () => {+ it('renders approximate quotes without an approximate marker', () => {expect(formatModelPricePair(quote({@@ -36,7 +36,7 @@ describe('modelPriceFormat', () => {outputPerMtok: 100.5,}),),- ).toBe('≈¥20.1 / ¥100.5');+ ).toBe('¥20.1 / ¥100.5');});it('includes configured cache prices in details', () => {diff --git a/apps/desktop/src/renderer/lib/__tests__/turnUsageTooltip.test.ts b/apps/desktop/src/renderer/lib/__tests__/turnUsageTooltip.test.tsindex 5ea43eabeb..de1f50f2c1 100644--- a/apps/desktop/src/renderer/lib/__tests__/turnUsageTooltip.test.ts+++ b/apps/desktop/src/renderer/lib/__tests__/turnUsageTooltip.test.ts@@ -64,7 +64,7 @@ describe('buildTurnUsageTooltipLines — 按模型成本明细', () => {(l) =>l.startsWith('usageDetails.modelCostLine') &&l.includes('Opus 4.8') &&- l.includes('≈¥6.30'),+ l.includes('¥6.30'),),).toBe(true);expect(@@ -72,7 +72,7 @@ describe('buildTurnUsageTooltipLines — 按模型成本明细', () => {(l) =>l.startsWith('usageDetails.modelCostLine') &&l.includes('Haiku 4.5') &&- l.includes('≈¥5.36'),+ l.includes('¥5.36'),),).toBe(true);expect(out.some((l) => l.startsWith('usageDetails.modelLine'))).toBe(false);diff --git a/apps/desktop/src/renderer/lib/modelPriceFormat.ts b/apps/desktop/src/renderer/lib/modelPriceFormat.tsindex 9faa8f0978..fc3561a29c 100644--- a/apps/desktop/src/renderer/lib/modelPriceFormat.ts+++ b/apps/desktop/src/renderer/lib/modelPriceFormat.ts@@ -40,7 +40,7 @@ export function formatModelPriceAmount(amount: number, currency: MoneyCurrency):export function formatModelPricePair(quote: ModelPriceQuote): string {const input = formatModelPriceAmount(quote.inputPerMtok, quote.currency);const output = formatModelPriceAmount(quote.outputPerMtok, quote.currency);- return `${quote.approximate ? '≈' : ''}${input} / ${output}`;+ return `${input} / ${output}`;}export function modelPriceDiscountLabelValues(discount: number): {diff --git a/apps/desktop/src/renderer/lib/usageFormat.ts b/apps/desktop/src/renderer/lib/usageFormat.tsindex 6f53ddb09f..f9bc0266f7 100644--- a/apps/desktop/src/renderer/lib/usageFormat.ts+++ b/apps/desktop/src/renderer/lib/usageFormat.ts@@ -37,10 +37,10 @@ export function formatTurnCostUsd(n: number): string {}function moneyPrefix(money: RegionalMoney): string {- return `${money.approximate ? '≈' : ''}${money.currency === 'CNY' ? '¥' : '$'}`;+ return money.currency === 'CNY' ? '¥' : '$';}-/** 区域金额的紧凑展示;币种与约值语义来自金额本身。 */+/** 区域金额的紧凑展示;币种来自金额本身。 */export function formatCompactMoney(money: RegionalMoney): string {const prefix = moneyPrefix(money);if (money.amount >= 1000) return `${prefix}${(money.amount / 1000).toFixed(1)}k`;@@ -56,14 +56,13 @@ export function formatMoney(money: RegionalMoney): string {/** 每轮 / 每模型金额:固定两位;小于最小货币展示单位时显示下界。 */export function formatTurnCostMoney(money: RegionalMoney): string {const symbol = money.currency === 'CNY' ? '¥' : '$';- const approximate = money.approximate ? '≈' : '';if (money.amount === 0) {- return `${approximate}${symbol}0.00`;+ return `${symbol}0.00`;}if (money.amount >= 0.01) {- return `${approximate}${symbol}${money.amount.toFixed(2)}`;+ return `${symbol}${money.amount.toFixed(2)}`;}- return `${approximate}<${symbol}0.01`;+ return `<${symbol}0.01`;}/**