Fix cost currency display / 修复成本货币符号显示#4061
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 666848e2dc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (/^\p{Sc}$/u.test(value)) return value; | ||
| if (/^[a-z]{3}$/i.test(value)) return `${value.toUpperCase()} `; | ||
|
|
||
| return DEFAULT_CURRENCY_SYMBOL; |
There was a problem hiding this comment.
Preserve configured multi-character currency symbols
When a provider/session supplies a compact multi-character symbol such as A$, CA$, HK$, or R$, this new formatter falls through to the yen default, so formatMoney(1, "A$") renders as ¥1.00 instead of preserving the configured currency. The old StatusBar/ContextPanel helpers passed unknown display symbols through, and Pricing.Currency is still described as accepting a display symbol, so existing non-USD/CNY configs using these common symbols will have their spend mislabeled; allow symbols containing a currency sign rather than defaulting them to yen.
Useful? React with 👍 / 👎.
The normalizer only passed through single-rune currency signs, so compact symbols like A$, CA$, HK$, R$ fell back to ¥ and mislabeled non-USD/CNY spend. Match on any embedded currency sign instead, on both the Go (provider) and frontend (money.ts) sides.
|
Thanks @SivanCola — clean fix for the currency mislabeling, and good call sharing the formatter into I pushed one follow-up commit before merging: the normalizer only passed through single-rune currency signs, so compact multi-character symbols ( |
Summary
Root cause
The context panel could select
info.sessionCostwhile still preferring the global session currency, whose initial value defaults to yuan. Separately, unknown currency text was passed through directly, so bad or stale currency values could appear before the numeric cost.Validation
npm --prefix desktop/frontend testnpm --prefix desktop/frontend run buildgo test ./internal/providergo test ./...from the desktop moduleThis change is display-only and does not modify provider request serialization, prompts, tool schemas, or other prompt-cache-sensitive paths.