fix: show output/cache/create_cache prices when channel-level pricing provides the ratio, not only when global pricing has it

This commit is contained in:
xiezhouwei 2026-06-23 11:00:44 +08:00
parent 4a7cb9e0f0
commit d676e2200f
1 changed files with 9 additions and 12 deletions

View File

@ -304,46 +304,43 @@ const ModelChannelList = ({
: null; : null;
items.push(makeItem(t('输入价格'), effInputRate, modelData?.model_ratio, false)); items.push(makeItem(t('输入价格'), effInputRate, modelData?.model_ratio, false));
// completion_ratio // completion_ratio
if ( if (
hasRatioValue(channel.model_ratio) && hasRatioValue(channel.model_ratio) &&
hasRatioValue(channel.completion_ratio) && hasRatioValue(channel.completion_ratio)
hasRatioValue(modelData?.completion_ratio)
) { ) {
const effOut = const effOut =
Number(channel.model_ratio) * Number(channel.completion_ratio) * costDisc + Number(channel.model_ratio) * Number(channel.completion_ratio) * costDisc +
globalMr * globalCR * markupRate; 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) ? Number(modelData.model_ratio) * Number(modelData.completion_ratio)
: null; : null;
items.push(makeItem(t('输出价格'), effOut, rootOut, false)); items.push(makeItem(t('输出价格'), effOut, rootOut, false));
} }
// cache_ratio // cache_ratio
if ( if (
hasRatioValue(channel.model_ratio) && hasRatioValue(channel.model_ratio) &&
hasRatioValue(channel.cache_ratio) && hasRatioValue(channel.cache_ratio)
hasRatioValue(modelData?.cache_ratio)
) { ) {
const effCacheRate = const effCacheRate =
Number(channel.model_ratio) * Number(channel.cache_ratio) * costDisc + Number(channel.model_ratio) * Number(channel.cache_ratio) * costDisc +
globalMr * globalCacheR * markupRate; 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) ? Number(modelData.model_ratio) * Number(modelData.cache_ratio)
: null; : null;
items.push(makeItem(t('缓存读取价格'), effCacheRate, rootC, false)); items.push(makeItem(t('缓存读取价格'), effCacheRate, rootC, false));
} }
// create_cache_ratio // create_cache_ratio
if ( if (
hasRatioValue(channel.model_ratio) && hasRatioValue(channel.model_ratio) &&
hasRatioValue(channel.create_cache_ratio) && hasRatioValue(channel.create_cache_ratio)
hasRatioValue(modelData?.create_cache_ratio)
) { ) {
const effCreateCacheRate = const effCreateCacheRate =
Number(channel.model_ratio) * Number(channel.create_cache_ratio) * costDisc + Number(channel.model_ratio) * Number(channel.create_cache_ratio) * costDisc +
globalMr * globalCreateCacheR * markupRate; 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) ? Number(modelData.model_ratio) * Number(modelData.create_cache_ratio)
: null; : null;
items.push(makeItem(t('缓存创建价格'), effCreateCacheRate, rootCC, false)); items.push(makeItem(t('缓存创建价格'), effCreateCacheRate, rootCC, false));