diff --git a/setting/operation_setting/cache_ratio.go b/setting/operation_setting/cache_ratio.go index 5943dcfa..d7a3d973 100644 --- a/setting/operation_setting/cache_ratio.go +++ b/setting/operation_setting/cache_ratio.go @@ -21,6 +21,8 @@ var defaultCacheRatio = map[string]float64{ "deepseek-coder": 0.5, } +var defaultCreateCacheRatio = map[string]float64{} + var cacheRatioMap map[string]float64 var cacheRatioMapMutex sync.RWMutex @@ -57,7 +59,7 @@ func GetCacheRatio(name string) (float64, bool) { GetCacheRatioMap() ratio, ok := cacheRatioMap[name] if !ok { - return 0.5, false // Default to 0.5 if not found + return 1, false // Default to 0.5 if not found } return ratio, true } diff --git a/web/src/components/LogsTable.js b/web/src/components/LogsTable.js index cf1dbaea..abf28297 100644 --- a/web/src/components/LogsTable.js +++ b/web/src/components/LogsTable.js @@ -638,6 +638,12 @@ const LogsTable = () => { value: other.text_output, }); } + if (other?.cache_tokens > 0) { + expandDataLocal.push({ + key: t('缓存 Tokens'), + value: other.cache_tokens, + }); + } expandDataLocal.push({ key: t('日志详情'), value: logs[i].content, diff --git a/web/src/helpers/render.js b/web/src/helpers/render.js index c71df108..d4add44f 100644 --- a/web/src/helpers/render.js +++ b/web/src/helpers/render.js @@ -336,7 +336,7 @@ export function renderModelPrice( total: completionRatioPrice * groupRatio })}

{cacheTokens > 0 && ( -

{i18next.t('缓存:${{price}} * {{ratio}} = ${{total}} / 1M tokens (缓存比例: {{cacheRatio}})', { +

{i18next.t('缓存:${{price}} * {{ratio}} = ${{total}} / 1M tokens (缓存倍率: {{cacheRatio}})', { price: cacheRatioPrice, ratio: groupRatio, total: cacheRatioPrice * groupRatio, @@ -387,7 +387,7 @@ export function renderModelPriceSimple( }); } else { if (cacheTokens !== 0) { - return i18next.t('模型: {{ratio}} * 分组: {{groupRatio}} * 缓存比例: {{cacheRatio}}', { + return i18next.t('模型: {{ratio}} * 分组: {{groupRatio}} * 缓存倍率: {{cacheRatio}}', { ratio: modelRatio, groupRatio: groupRatio, cacheRatio: cacheRatio @@ -452,7 +452,7 @@ export function renderAudioModelPrice( total: completionRatioPrice * groupRatio })}

{cacheTokens > 0 && ( -

{i18next.t('缓存:${{price}} * {{ratio}} = ${{total}} / 1M tokens (缓存比例: {{cacheRatio}})', { +

{i18next.t('缓存:${{price}} * {{ratio}} = ${{total}} / 1M tokens (缓存倍率: {{cacheRatio}})', { price: cacheRatioPrice, ratio: groupRatio, total: cacheRatioPrice * groupRatio,