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