fix: filter pricing variables based on cache token availability in tiered model price rendering
This commit is contained in:
Vendored
+11
-2
@@ -2293,7 +2293,12 @@ export function renderTieredModelPrice(opts) {
|
|||||||
const { symbol, rate } = getCurrencyConfig();
|
const { symbol, rate } = getCurrencyConfig();
|
||||||
const gr = groupRatio || 1;
|
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 = [
|
const lines = [
|
||||||
buildBillingText('命中档位:{{tier}}', { tier: matchedTier || tier.label }),
|
buildBillingText('命中档位:{{tier}}', { tier: matchedTier || tier.label }),
|
||||||
@@ -2334,7 +2339,11 @@ export function renderTieredModelPriceSimple(opts) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (tier && isPriceDisplayMode(displayMode)) {
|
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) {
|
for (const [field, label] of priceSegments) {
|
||||||
if (tier[field] > 0) {
|
if (tier[field] > 0) {
|
||||||
segments.push({
|
segments.push({
|
||||||
|
|||||||
Reference in New Issue
Block a user