Compare commits
3 Commits
4a7cb9e0f0
...
648c9917ab
| Author | SHA1 | Date |
|---|---|---|
|
|
648c9917ab | |
|
|
a93c04ce28 | |
|
|
d676e2200f |
|
|
@ -304,46 +304,43 @@ const ModelChannelList = ({
|
|||
: null;
|
||||
items.push(makeItem(t('输入价格'), effInputRate, modelData?.model_ratio, false));
|
||||
|
||||
// 输出价格:仅当全局模型配置了 completion_ratio 时才展示
|
||||
// 输出价格:渠道有 completion_ratio 即可展示(不强制要求全局配置)
|
||||
if (
|
||||
hasRatioValue(channel.model_ratio) &&
|
||||
hasRatioValue(channel.completion_ratio) &&
|
||||
hasRatioValue(modelData?.completion_ratio)
|
||||
hasRatioValue(channel.completion_ratio)
|
||||
) {
|
||||
const effOut =
|
||||
Number(channel.model_ratio) * Number(channel.completion_ratio) * costDisc +
|
||||
globalMr * globalCR * markupRate;
|
||||
const rootOut = hasRatioValue(modelData?.model_ratio)
|
||||
const rootOut = hasRatioValue(modelData?.model_ratio) && hasRatioValue(modelData?.completion_ratio)
|
||||
? Number(modelData.model_ratio) * Number(modelData.completion_ratio)
|
||||
: null;
|
||||
items.push(makeItem(t('输出价格'), effOut, rootOut, false));
|
||||
}
|
||||
|
||||
// 缓存读取价格:仅当全局模型配置了 cache_ratio 时才展示
|
||||
// 缓存读取价格:渠道有 cache_ratio 即可展示(不强制要求全局配置)
|
||||
if (
|
||||
hasRatioValue(channel.model_ratio) &&
|
||||
hasRatioValue(channel.cache_ratio) &&
|
||||
hasRatioValue(modelData?.cache_ratio)
|
||||
hasRatioValue(channel.cache_ratio)
|
||||
) {
|
||||
const effCacheRate =
|
||||
Number(channel.model_ratio) * Number(channel.cache_ratio) * costDisc +
|
||||
globalMr * globalCacheR * markupRate;
|
||||
const rootC = hasRatioValue(modelData?.model_ratio)
|
||||
const rootC = hasRatioValue(modelData?.model_ratio) && hasRatioValue(modelData?.cache_ratio)
|
||||
? Number(modelData.model_ratio) * Number(modelData.cache_ratio)
|
||||
: null;
|
||||
items.push(makeItem(t('缓存读取价格'), effCacheRate, rootC, false));
|
||||
}
|
||||
|
||||
// 缓存创建价格:仅当全局模型配置了 create_cache_ratio 时才展示
|
||||
// 缓存创建价格:渠道有 create_cache_ratio 即可展示(不强制要求全局配置)
|
||||
if (
|
||||
hasRatioValue(channel.model_ratio) &&
|
||||
hasRatioValue(channel.create_cache_ratio) &&
|
||||
hasRatioValue(modelData?.create_cache_ratio)
|
||||
hasRatioValue(channel.create_cache_ratio)
|
||||
) {
|
||||
const effCreateCacheRate =
|
||||
Number(channel.model_ratio) * Number(channel.create_cache_ratio) * costDisc +
|
||||
globalMr * globalCreateCacheR * markupRate;
|
||||
const rootCC = hasRatioValue(modelData?.model_ratio)
|
||||
const rootCC = hasRatioValue(modelData?.model_ratio) && hasRatioValue(modelData?.create_cache_ratio)
|
||||
? Number(modelData.model_ratio) * Number(modelData.create_cache_ratio)
|
||||
: null;
|
||||
items.push(makeItem(t('缓存创建价格'), effCreateCacheRate, rootCC, false));
|
||||
|
|
|
|||
|
|
@ -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,6 +557,7 @@ const PricingCardView = ({
|
|||
});
|
||||
}
|
||||
|
||||
// 卡片表面仅展示输入/输出价格,缓存价格不在卡片上显示(详情弹窗中仍可见)
|
||||
// if (cache) {
|
||||
// items.push({
|
||||
// key: 'cache',
|
||||
|
|
@ -569,7 +567,7 @@ const PricingCardView = ({
|
|||
// original: original?.cache,
|
||||
// });
|
||||
// }
|
||||
|
||||
//
|
||||
// if (createCache) {
|
||||
// items.push({
|
||||
// key: 'create-cache',
|
||||
|
|
@ -797,28 +795,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