From c6bb1dcc0ec755d9dd774d079fc18af51f49100d Mon Sep 17 00:00:00 2001 From: t0ng7u Date: Fri, 8 Aug 2025 15:11:31 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20refactor(pricing):=20render=20?= =?UTF-8?q?=E2=80=9Cauto=E2=80=9D=20routing=20chain=20only=20when=20releva?= =?UTF-8?q?nt=20&=20remove=20unused=20prop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes 1. ModelPricingTable.jsx • Compute `autoChain` as the intersection of `autoGroups` and the model’s `enable_groups` (order preserved). • Display the chain banner only when `autoChain.length > 0`; banner shows the reduced path (e.g. `a → c → e`). • Dropped obsolete `selectedGroup` prop; all callers updated. 2. ModelDetailSideSheet.jsx / PricingPage.jsx • Removed forwarding of deleted `selectedGroup` prop. Outcome – “Auto group routing” appears only for models that actually participate in the chain, avoiding empty or irrelevant banners. – Codebase simplified by eliminating an unused prop. --- .../modal/components/ModelPricingTable.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/web/src/components/table/model-pricing/modal/components/ModelPricingTable.jsx b/web/src/components/table/model-pricing/modal/components/ModelPricingTable.jsx index de52eae6..f856eecb 100644 --- a/web/src/components/table/model-pricing/modal/components/ModelPricingTable.jsx +++ b/web/src/components/table/model-pricing/modal/components/ModelPricingTable.jsx @@ -35,11 +35,11 @@ const ModelPricingTable = ({ autoGroups = [], t, }) => { + const modelEnableGroups = Array.isArray(modelData?.enable_groups) ? modelData.enable_groups : []; + const autoChain = autoGroups.filter(g => modelEnableGroups.includes(g)); const renderGroupPriceTable = () => { // 仅展示模型可用的分组:模型 enable_groups 与用户可用分组的交集 - const modelEnableGroups = Array.isArray(modelData?.enable_groups) - ? modelData.enable_groups - : []; + const availableGroups = Object.keys(usableGroup || {}) .filter(g => g !== '') .filter(g => g !== 'auto') @@ -169,14 +169,14 @@ const ModelPricingTable = ({
{t('不同用户分组的价格信息')}
- {autoGroups && autoGroups.length > 0 && ( + {autoChain.length > 0 && (
{t('auto分组调用链路')} - {autoGroups.map((g, idx) => ( + {autoChain.map((g, idx) => ( {g}{t('分组')} - {idx < autoGroups.length - 1 && } + {idx < autoChain.length - 1 && } ))}