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:
parent
4a7cb9e0f0
commit
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));
|
||||
|
|
|
|||
Loading…
Reference in New Issue