fix: filter pricing variables based on cache token availability in tiered model price rendering

This commit is contained in:
CaIon
2026-04-28 11:29:30 +08:00
parent bee339d279
commit 9f8a4ec050
+11 -2
View File
@@ -2293,7 +2293,12 @@ export function renderTieredModelPrice(opts) {
const { symbol, rate } = getCurrencyConfig();
const gr = groupRatio || 1;
const priceLines = BILLING_PRICING_VARS.map((v) => [v.field, v.label]);
const hasAnyCacheTokens = cacheTokens > 0 || cacheCreationTokens > 0
|| cacheCreationTokens5m > 0 || cacheCreationTokens1h > 0;
const priceLines = BILLING_PRICING_VARS
.filter((v) => v.group !== 'cache' || hasAnyCacheTokens)
.map((v) => [v.field, v.label]);
const lines = [
buildBillingText('命中档位:{{tier}}', { tier: matchedTier || tier.label }),
@@ -2334,7 +2339,11 @@ export function renderTieredModelPriceSimple(opts) {
];
if (tier && isPriceDisplayMode(displayMode)) {
const priceSegments = BILLING_PRICING_VARS.map((v) => [v.field, v.shortLabel]);
const hasAnyCacheTokens = cacheTokens > 0 || cacheCreationTokens > 0
|| cacheCreationTokens5m > 0 || cacheCreationTokens1h > 0;
const priceSegments = BILLING_PRICING_VARS
.filter((v) => v.group !== 'cache' || hasAnyCacheTokens)
.map((v) => [v.field, v.shortLabel]);
for (const [field, label] of priceSegments) {
if (tier[field] > 0) {
segments.push({