Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(models): place discount before supplementary pricing
fmfsaisai1c4319265eea
diff --git a/apps/desktop/src/renderer/components/settings/ModelAdvancedDrawer.tsx b/apps/desktop/src/renderer/components/settings/ModelAdvancedDrawer.tsxindex c24870258c..2d1aad57ca 100644--- a/apps/desktop/src/renderer/components/settings/ModelAdvancedDrawer.tsx+++ b/apps/desktop/src/renderer/components/settings/ModelAdvancedDrawer.tsx@@ -1024,12 +1024,6 @@ export function ModelAdvancedDrawer({</Row>);})}- {/* Keep conditions and notes; omit a plain table fully covered by the summary. */}- {!isDisplayPricingTableRedundant(primaryModel.displayPricing) && (- <div className={primaryModel.displayPricing.summary ? 'pt-3' : undefined}>- <DisplayPricingDetails model={primaryModel} />- </div>- )}</>) : price === null ? (<Row label={t('settings.providers.models.advanced.pricingLabel')} muted>@@ -1076,6 +1070,13 @@ export function ModelAdvancedDrawer({</span></Row>)}+ {/* Keep conditions and notes after the primary quotes and their discount. */}+ {primaryModel.displayPricing && primaryModel.currency &&+ !isDisplayPricingTableRedundant(primaryModel.displayPricing) && (+ <div className={primaryModel.displayPricing.summary ? 'pt-3' : undefined}>+ <DisplayPricingDetails model={primaryModel} />+ </div>+ )}{/* 自定义报价:原「⋯」菜单的一项,搬到它真正相关的段落里。XD 网关的价格由服务端定,不给覆盖入口(与 IPC 侧的拒绝一致)。 */}{provider.id !== 'xd' && !isOrganizationManagedProvider(provider) && !paymentRequired && (diff --git a/apps/desktop/src/renderer/components/settings/__tests__/ModelAdvancedDrawer.test.tsx b/apps/desktop/src/renderer/components/settings/__tests__/ModelAdvancedDrawer.test.tsxindex 021ebdea6d..4ca5646caf 100644--- a/apps/desktop/src/renderer/components/settings/__tests__/ModelAdvancedDrawer.test.tsx+++ b/apps/desktop/src/renderer/components/settings/__tests__/ModelAdvancedDrawer.test.tsx@@ -833,6 +833,7 @@ it.each([false, true])('omits only a fully redundant supplementary table (notes=// Unit regression: the real drawer hid the discount row for displayPricing models.// Existing summary tests checked discounted amounts but not the separate discount row.// Minimal failure: one video quote with costDiscount=0.4 and no token price presentation.+// Discount-order regression: the row must follow summary quotes and precede supplementary items.it.each([{ costDiscount: 0.4, pricing: 'summary', expected: '↓40%' },{ costDiscount: 0.4, pricing: 'table', expected: '↓40%' },@@ -848,8 +849,16 @@ it.each([} }),});const label = screen.queryByText('settings.providers.models.advanced.discount');- if (expected) expect(label?.parentElement?.textContent).toContain(expected);- else expect(label).toBeNull();+ if (expected) {+ expect(label?.parentElement?.textContent).toContain(expected);+ if (pricing !== 'chat') {+ expect(label!.compareDocumentPosition(screen.getByText('Generated video')) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();+ }+ if (pricing === 'summary') {+ const outputRow = screen.getByText('settings.providers.models.advanced.price.output').parentElement!;+ expect(outputRow.nextElementSibling).toBe(label!.parentElement);+ }+ } else expect(label).toBeNull();});// Unit regression found during review: ordinary Gateway chat projections carry effective cost,@@ -866,4 +875,6 @@ it('retains the chat discount inferred from standard and effective prices', () =}, primary.cost)}/>);expect(screen.getByText('settings.providers.models.advanced.discount').parentElement?.textContent).toContain('↓40%');+ const outputRow = screen.getByText('settings.providers.models.advanced.price.output').parentElement!;+ expect(outputRow.nextElementSibling).toBe(screen.getByText('settings.providers.models.advanced.discount').parentElement);});