fix(desktop): send provider currency in Meta to prevent session-start flip (#4546)#4548
Open
ashishexee wants to merge 1 commit into
Open
Conversation
2792bf4 to
60241d0
Compare
… flip (esengine#4546) The status bar cost display flipped from ¥ (CNY) to $ (USD) when the first usage event arrived because sessionCurrency defaulted to ¥ in the frontend initialState, while DeepSeek's pricing is configured in USD. Now the Controller stores the provider's currency symbol (from entry.Price.Symbol()) at build time, and MetaForTab() includes it in the Meta event. The frontend reads meta.currency on session start and initializes sessionCurrency immediately — before any usage event. Fixes: - case "meta" sets sessionCurrency from meta.currency - case "reset" preserves sessionCurrency (was lost to initialState spread) - MetaForTab() nil-guards tab.Ctrl - sameMeta() includes currency in comparison
60241d0 to
e23081c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
#4546 reports that the status bar cost display shows inconsistent currencies:
¥0.0000(CNY)$0.0000(USD)The root cause is two hardcoded defaults that disagree:
useController.ts:119—sessionCurrency: "¥"(hardcoded CNY in frontend initial state)config.go:1271— DeepSeek pricing:Currency: "$"(USD)The
sessionCurrencyfield only updates when ausageevent arrives from the backend (line 510). Before that, it stays at the hardcoded"¥"default.Fix
Thread the provider's currency symbol from config through Controller to Meta, so the frontend knows the currency at session start — before any usage event.
Backend (Go):
internal/control/controller.go— AddcurrencySymbolfield to Controller withCurrencySymbol()getter; addCurrencySymboltoOptionsstructinternal/boot/boot.go— SetCurrencySymbol: entry.Price.Symbol()in controller options (nil-safe:Pricing.Symbol()returns"¥"for nil/empty)desktop/app.go— AddCurrency stringtoMetastruct; populate inMetaForTab()with nil guard ontab.CtrlFrontend (TypeScript):
types.ts— Addcurrency?: stringtoMetainterfaceuseController.ts—case "meta"setssessionCurrencyfrommeta.currency;case "reset"preservessessionCurrency;sameMeta()includescurrencyin comparisonVerification
Fixes #4546