From 17d18b7a18f210236cdb835f3ea8b07da0dd39d9 Mon Sep 17 00:00:00 2001 From: rookie Date: Fri, 31 Jul 2026 14:15:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E5=91=BD=E4=B8=AD=E7=8E=87=E8=AE=A1=E7=AE=97=EF=BC=8C=E5=88=86?= =?UTF-8?q?=E6=AF=8D=E6=94=B9=E4=B8=BA=E7=BC=93=E5=AD=98=E5=91=BD=E4=B8=AD?= =?UTF-8?q?+=E6=9C=AA=E5=91=BD=E4=B8=AD(input)=E7=9A=84=E6=80=BB=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit input_consumption 现在表示未命中缓存的数量,因此缓存命中率分母 应由原来的 input 改为 cache_hit_token + input_consumption, 否则比率会偏高。 --- .../aiChatContent/AIContextToken/AIEchartsDetails.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/renderer/src/main/src/pages/ai-agent/aiChatContent/AIContextToken/AIEchartsDetails.tsx b/app/renderer/src/main/src/pages/ai-agent/aiChatContent/AIContextToken/AIEchartsDetails.tsx index 18d9498033..9339ca3e09 100644 --- a/app/renderer/src/main/src/pages/ai-agent/aiChatContent/AIContextToken/AIEchartsDetails.tsx +++ b/app/renderer/src/main/src/pages/ai-agent/aiChatContent/AIContextToken/AIEchartsDetails.tsx @@ -84,8 +84,9 @@ const AIEchartsDetails: React.FC = ({ const output = tierConsumption.intelligent.output_consumption || 0 const cacheHit = tierConsumption.intelligent.cache_hit_token || 0 let percent = 0 - if (input !== 0 && cacheHit !== 0) { - percent = Number(((Number(cacheHit) / Number(input)) * 100).toFixed(2)) + const totalInput = Number(cacheHit) + Number(input) + if (totalInput !== 0 && cacheHit !== 0) { + percent = Number(((Number(cacheHit) / totalInput) * 100).toFixed(2)) } return [formatNumberUnits(input), formatNumberUnits(output), formatNumberUnits(cacheHit), percent] }, [renderNumber, tierConsumption?.intelligent]) @@ -96,8 +97,9 @@ const AIEchartsDetails: React.FC = ({ const output = tierConsumption.lightweight.output_consumption || 0 const cacheHit = tierConsumption.lightweight.cache_hit_token || 0 let percent = 0 - if (input !== 0 && cacheHit !== 0) { - percent = Number(((Number(cacheHit) / Number(input)) * 100).toFixed(2)) + const totalInput = Number(cacheHit) + Number(input) + if (totalInput !== 0 && cacheHit !== 0) { + percent = Number(((Number(cacheHit) / totalInput) * 100).toFixed(2)) } return [formatNumberUnits(input), formatNumberUnits(output), formatNumberUnits(cacheHit), percent] }, [renderNumber, tierConsumption?.lightweight])