fix: show all configured channel prices (output/cache/createCache) on model card surface, not just input

This commit is contained in:
xiezhouwei 2026-06-23 11:09:12 +08:00
parent d676e2200f
commit a93c04ce28
1 changed files with 28 additions and 48 deletions

View File

@ -244,11 +244,10 @@ const PricingCardView = ({
);
originalPrices.input.push(formatPrice(billingRates.inputRatioPrice));
// completion_ratio
// completion_ratio
if (
ch.completion_ratio !== undefined &&
ch.completion_ratio !== null &&
model.completion_ratio != null
ch.completion_ratio !== null
) {
prices.output.push(
formatPrice(billingRates.completionRatioPrice * usedGroupRatio),
@ -258,11 +257,10 @@ const PricingCardView = ({
);
}
// cache_ratio
// cache_ratio
if (
ch.cache_ratio !== undefined &&
ch.cache_ratio !== null &&
model.cache_ratio != null
ch.cache_ratio !== null
) {
prices.cache.push(
formatPrice(billingRates.cacheRatioPrice * usedGroupRatio),
@ -270,11 +268,10 @@ const PricingCardView = ({
originalPrices.cache.push(formatPrice(billingRates.cacheRatioPrice));
}
// create_cache_ratio
// create_cache_ratio
if (
ch.create_cache_ratio !== undefined &&
ch.create_cache_ratio !== null &&
model.create_cache_ratio != null
ch.create_cache_ratio !== null
) {
prices.createCache.push(
formatPrice(
@ -560,25 +557,25 @@ const PricingCardView = ({
});
}
// if (cache) {
// items.push({
// key: 'cache',
// label: t(''),
// value: cache.single || `${cache.symbol}${cache.min} ~ ${cache.symbol}${cache.max}`,
// suffix: unitSuffix,
// original: original?.cache,
// });
// }
if (cache) {
items.push({
key: 'cache',
label: t('缓存读取价格'),
value: cache.single || `${cache.symbol}${cache.min} ~ ${cache.symbol}${cache.max}`,
suffix: unitSuffix,
original: original?.cache,
});
}
// if (createCache) {
// items.push({
// key: 'create-cache',
// label: t(''),
// value: createCache.single || `${createCache.symbol}${createCache.min} ~ ${createCache.symbol}${createCache.max}`,
// suffix: unitSuffix,
// original: original?.createCache,
// });
// }
if (createCache) {
items.push({
key: 'create-cache',
label: t('缓存创建价格'),
value: createCache.single || `${createCache.symbol}${createCache.min} ~ ${createCache.symbol}${createCache.max}`,
suffix: unitSuffix,
original: original?.createCache,
});
}
}
if (videoFlat) {
@ -797,28 +794,11 @@ const PricingCardView = ({
>
{(() => {
const items = getModelPriceItemsForCard(model, priceData);
const inputItem = items.find(i => i.key === 'input');
const outputItem = items.find(i => i.key === 'output');
if (items.length === 0) return null;
return (
<div className='flex gap-3'>
{inputItem && (
<div className='flex-1 rounded-xl px-3 py-2.5' style={{backgroundColor: 'var(--semi-color-fill-0)'}}>
<div className='text-[10px] mb-0.5' style={{color: 'var(--semi-color-text-2)'}}>{inputItem.label}</div>
<div className='text-sm font-bold text-gray-900'>
{inputItem.value}{inputItem.suffix}
</div>
</div>
)}
{outputItem && (
<div className='flex-1 rounded-xl px-3 py-2.5' style={{backgroundColor: 'var(--semi-color-fill-0)'}}>
<div className='text-[10px] mb-0.5' style={{color: 'var(--semi-color-text-2)'}}>{outputItem.label}</div>
<div className='text-sm font-bold text-gray-900'>
{outputItem.value}{outputItem.suffix}
</div>
</div>
)}
{!inputItem && !outputItem && items.map(item => (
<div key={item.key} className='flex-1 rounded-xl px-3 py-2.5' style={{backgroundColor: 'var(--semi-color-fill-0)'}}>
<div className='flex flex-wrap gap-3'>
{items.map(item => (
<div key={item.key} className='flex-1 rounded-xl px-3 py-2.5' style={{backgroundColor: 'var(--semi-color-fill-0)', minWidth: '120px'}}>
<div className='text-[10px] mb-0.5' style={{color: 'var(--semi-color-text-2)'}}>{item.label}</div>
<div className='text-sm font-bold text-gray-900'>
{item.valueNode || (item.value + (item.suffix || ''))}