fix: show all configured channel prices (output/cache/createCache) on model card surface, not just input
This commit is contained in:
parent
d676e2200f
commit
a93c04ce28
|
|
@ -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 || ''))}
|
||||
|
|
|
|||
Loading…
Reference in New Issue