From 7b34fbc88a87d52129f072e5902d4feba203cae3 Mon Sep 17 00:00:00 2001 From: fengsilin Date: Thu, 4 Jun 2026 14:13:39 +0800 Subject: [PATCH] feat(pricing): hide cache creation price when ratio is 0 - Add cacheCreationRatio !== 0 check for row data - Add hasCacheCreationPricing check for column visibility - Models with cache read but no cache creation (e.g. Gemini) no longer show empty cache creation price column Co-Authored-By: Claude Sonnet 4.6 --- .../modal/components/ModelPricingTable.jsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 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 6f03729..188f8a0 100644 --- a/web/src/components/table/model-pricing/modal/components/ModelPricingTable.jsx +++ b/web/src/components/table/model-pricing/modal/components/ModelPricingTable.jsx @@ -84,7 +84,7 @@ const ModelPricingTable = ({ ? priceData.cachePrice : '-', cacheCreationPrice: - modelData?.quota_type === 0 && priceData.cacheRatio !== 1 + modelData?.quota_type === 0 && priceData.cacheRatio !== 1 && priceData.cacheCreationRatio !== 0 ? priceData.cacheCreationPrice : '-', fixedPrice: modelData?.quota_type === 1 ? priceData.price : '-', @@ -136,6 +136,10 @@ const ModelPricingTable = ({ // 检查是否有缓存价格数据(模型支持缓存时同时显示缓存读取和缓存创建) const hasCachePricing = tableData.some((row) => row.cachePrice !== '-'); + // 检查是否有缓存创建价格数据(有些模型只有缓存读取没有缓存创建) + const hasCacheCreationPricing = tableData.some( + (row) => row.cacheCreationPrice !== '-' + ); // 根据计费类型添加价格列 if (modelData?.quota_type === 0) { @@ -181,8 +185,8 @@ const ModelPricingTable = ({ ), }); } - // 缓存创建价格列(仅在有缓存价格数据时显示,与缓存读取列同时出现) - if (hasCachePricing) { + // 缓存创建价格列(仅在有缓存创建价格数据时显示) + if (hasCachePricing && hasCacheCreationPricing) { columns.push({ title: t('缓存创建'), dataIndex: 'cacheCreationPrice',