From f9eeb7e47e53efd6b5133c1765153ac7d4c86f29 Mon Sep 17 00:00:00 2001 From: fengsilin Date: Sat, 9 May 2026 17:16:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(billing):=20=E4=BF=AE=E5=A4=8D=20Claude=20?= =?UTF-8?q?=E8=AE=A1=E8=B4=B9=E6=98=8E=E7=BB=86=E6=9C=AA=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=B8=A0=E9=81=93=E6=8A=98=E6=89=A3=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit renderClaudeModelPrice 函数缺少 userChannelRatio 参数声明,导致运行时 ReferenceError;同时价格计算未乘以用户倍率,明细文本也未显示折扣信息。 Co-Authored-By: Claude Sonnet 4 --- web/src/helpers/render.jsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/web/src/helpers/render.jsx b/web/src/helpers/render.jsx index c0021c0..0e02f96 100644 --- a/web/src/helpers/render.jsx +++ b/web/src/helpers/render.jsx @@ -1893,6 +1893,7 @@ export function renderClaudeModelPrice( cacheCreationRatio5m = 1.0, cacheCreationTokens1h = 0, cacheCreationRatio1h = 1.0, + userChannelRatio, ) { const { ratio: effectiveGroupRatio, label: ratioLabel } = getEffectiveRatio( groupRatio, @@ -1950,9 +1951,11 @@ export function renderClaudeModelPrice( cacheCreationTokens5m * cacheCreationRatio5m + cacheCreationTokens1h * cacheCreationRatio1h; + const userRatio = userChannelRatio ?? 1.0; let price = - (effectiveInputTokens / 1000000) * inputRatioPrice * groupRatio + - (completionTokens / 1000000) * completionRatioPrice * groupRatio; + ((effectiveInputTokens / 1000000) * inputRatioPrice * groupRatio + + (completionTokens / 1000000) * completionRatioPrice * groupRatio) * + userRatio; const inputUnitPrice = inputRatioPrice * rate; const completionUnitPrice = completionRatioPrice * rate; @@ -2132,11 +2135,12 @@ export function renderClaudeModelPrice(

{i18next.t( - '{{breakdown}} * {{ratioType}} {{ratio}} = {{symbol}}{{total}}', + '{{breakdown}} * {{ratioType}} {{ratio}}{{userRatioText}} = {{symbol}}{{total}}', { breakdown: breakdownText, ratioType: ratioLabel, ratio: groupRatio, + userRatioText: userRatio !== 1.0 ? i18next.t(' * 用户倍率 {{userRatio}}', { userRatio }) : '', symbol: symbol, total: (price * rate).toFixed(6), },