{line}
+ ))} +diff --git a/web/src/components/table/usage-logs/UsageLogsColumnDefs.jsx b/web/src/components/table/usage-logs/UsageLogsColumnDefs.jsx index 8d7141dd..2e80a904 100644 --- a/web/src/components/table/usage-logs/UsageLogsColumnDefs.jsx +++ b/web/src/components/table/usage-logs/UsageLogsColumnDefs.jsx @@ -25,21 +25,14 @@ import { Tooltip, Popover, Typography, - Button } from '@douyinfe/semi-ui'; import { - timestamp2string, renderGroup, renderQuota, stringToColor, getLogOther, renderModelTag, - renderClaudeLogContent, - renderLogContent, renderModelPriceSimple, - renderAudioModelPrice, - renderClaudeModelPrice, - renderModelPrice, } from '../../../helpers'; import { IconHelpCircle } from '@douyinfe/semi-icons'; import { Route, Sparkles } from 'lucide-react'; @@ -330,6 +323,142 @@ function getPromptCacheSummary(other) { }; } +function normalizeDetailText(detail) { + return String(detail || '') + .replace(/\n\r/g, '\n') + .replace(/\r\n/g, '\n'); +} + +function getUsageLogGroupSummary(groupRatio, userGroupRatio, t) { + const parsedUserGroupRatio = Number(userGroupRatio); + const useUserGroupRatio = + Number.isFinite(parsedUserGroupRatio) && parsedUserGroupRatio !== -1; + const ratio = useUserGroupRatio ? userGroupRatio : groupRatio; + if (ratio === undefined || ratio === null || ratio === '') { + return ''; + } + return `${useUserGroupRatio ? t('专属倍率') : t('分组')} ${formatRatio(ratio)}x`; +} + +function renderCompactDetailSummary(summarySegments) { + const segments = Array.isArray(summarySegments) + ? summarySegments.filter((segment) => segment?.text) + : []; + if (!segments.length) { + return null; + } + + return ( +
{line}
+ ))} +- {i18next.t('模型价格:{{symbol}}{{price}} / 次', { - symbol, - price: (modelPrice * rate).toFixed(6), - })} -
-- {i18next.t( - '模型价格 {{symbol}}{{price}} / 次 * {{ratioType}} {{ratio}} = {{symbol}}{{total}}', - { - symbol, - price: (modelPrice * rate).toFixed(6), - ratioType: ratioLabel, - ratio: groupRatio, - total: (modelPrice * groupRatio * rate).toFixed(6), - }, - )} -
-{i18next.t('仅供参考,以实际扣费为准')}
-- {i18next.t('输入价格:{{symbol}}{{price}} / 1M tokens{{audioPrice}}', { - symbol, - price: (inputRatioPrice * rate).toFixed(6), - audioPrice: audioInputSeperatePrice - ? `,${i18next.t('音频输入价格')} ${symbol}${(audioInputPrice * rate).toFixed(6)} / 1M tokens` - : '', - })} -
-- {i18next.t('补全价格:{{symbol}}{{total}} / 1M tokens', { - symbol, - total: (completionRatioPrice * rate).toFixed(6), - })} -
- {cacheTokens > 0 && ( -- {i18next.t('缓存读取价格:{{symbol}}{{total}} / 1M tokens', { - symbol, - total: (inputRatioPrice * cacheRatio * rate).toFixed(6), - })} -
- )} - {image && imageOutputTokens > 0 && ( -- {i18next.t('图片输入价格:{{symbol}}{{total}} / 1M tokens', { - symbol, - total: (imageRatioPrice * rate).toFixed(6), - })} -
- )} - {webSearch && webSearchCallCount > 0 && ( -- {i18next.t('Web搜索价格:{{symbol}}{{price}} / 1K 次', { - symbol, - price: (webSearchPrice * rate).toFixed(6), - })} -
- )} - {fileSearch && fileSearchCallCount > 0 && ( -- {i18next.t('文件搜索价格:{{symbol}}{{price}} / 1K 次', { - symbol, - price: (fileSearchPrice * rate).toFixed(6), - })} -
- )} - {imageGenerationCall && imageGenerationCallPrice > 0 && ( -- {i18next.t('图片生成调用:{{symbol}}{{price}} / 1次', { - symbol, - price: (imageGenerationCallPrice * rate).toFixed(6), - })} -
- )} -- {(() => { - let inputDesc = ''; - if (image && imageOutputTokens > 0) { - inputDesc = i18next.t( - '(输入 {{nonImageInput}} tokens + 图片输入 {{imageInput}} tokens / 1M tokens * {{symbol}}{{price}}', - { - nonImageInput: inputTokens - imageOutputTokens, - imageInput: imageOutputTokens, - symbol: symbol, - price: (inputRatioPrice * rate).toFixed(6), - }, - ); - } else if (cacheTokens > 0) { - inputDesc = i18next.t( - '(输入 {{nonCacheInput}} tokens / 1M tokens * {{symbol}}{{price}} + 缓存 {{cacheInput}} tokens / 1M tokens * {{symbol}}{{cachePrice}}', - { - nonCacheInput: inputTokens - cacheTokens, - cacheInput: cacheTokens, - symbol: symbol, - price: (inputRatioPrice * rate).toFixed(6), - cachePrice: (cacheRatioPrice * rate).toFixed(6), - }, - ); - } else if (audioInputSeperatePrice && audioInputTokens > 0) { - inputDesc = i18next.t( - '(输入 {{nonAudioInput}} tokens / 1M tokens * {{symbol}}{{price}} + 音频输入 {{audioInput}} tokens / 1M tokens * {{symbol}}{{audioPrice}}', - { - nonAudioInput: inputTokens - audioInputTokens, - audioInput: audioInputTokens, - symbol: symbol, - price: (inputRatioPrice * rate).toFixed(6), - audioPrice: (audioInputPrice * rate).toFixed(6), - }, - ); - } else { - inputDesc = i18next.t( - '(输入 {{input}} tokens / 1M tokens * {{symbol}}{{price}}', - { - input: inputTokens, - symbol: symbol, - price: (inputRatioPrice * rate).toFixed(6), - }, - ); - } + let inputDesc = ''; + if (image && imageOutputTokens > 0) { + inputDesc = buildBillingPriceText( + '(输入 {{nonImageInput}} tokens + 图片输入 {{imageInput}} tokens / 1M tokens * {{symbol}}{{price}}', + { + nonImageInput: inputTokens - imageOutputTokens, + imageInput: imageOutputTokens, + symbol, + usdAmount: inputRatioPrice, + rate, + }, + ); + } else if (cacheTokens > 0) { + inputDesc = buildBillingText( + '(输入 {{nonCacheInput}} tokens / 1M tokens * {{symbol}}{{price}} + 缓存 {{cacheInput}} tokens / 1M tokens * {{symbol}}{{cachePrice}}', + { + nonCacheInput: inputTokens - cacheTokens, + cacheInput: cacheTokens, + symbol, + price: formatBillingDisplayPrice(inputRatioPrice, rate), + cachePrice: formatBillingDisplayPrice(cacheRatioPrice, rate), + }, + ); + } else if (audioInputSeperatePrice && audioInputTokens > 0) { + inputDesc = buildBillingText( + '(输入 {{nonAudioInput}} tokens / 1M tokens * {{symbol}}{{price}} + 音频输入 {{audioInput}} tokens / 1M tokens * {{symbol}}{{audioPrice}}', + { + nonAudioInput: inputTokens - audioInputTokens, + audioInput: audioInputTokens, + symbol, + price: formatBillingDisplayPrice(inputRatioPrice, rate), + audioPrice: formatBillingDisplayPrice(audioInputPrice, rate), + }, + ); + } else { + inputDesc = buildBillingPriceText( + '(输入 {{input}} tokens / 1M tokens * {{symbol}}{{price}}', + { + input: inputTokens, + symbol, + usdAmount: inputRatioPrice, + rate, + }, + ); + } - const outputDesc = i18next.t( - '输出 {{completion}} tokens / 1M tokens * {{symbol}}{{compPrice}}) * {{ratioType}} {{ratio}}', - { - completion: completionTokens, - symbol: symbol, - compPrice: (completionRatioPrice * rate).toFixed(6), - ratio: groupRatio, - ratioType: ratioLabel, - }, - ); - - const extraServices = [ - webSearch && webSearchCallCount > 0 - ? i18next.t( - ' + Web搜索 {{count}}次 / 1K 次 * {{symbol}}{{price}} * {{ratioType}} {{ratio}}', - { - count: webSearchCallCount, - symbol: symbol, - price: (webSearchPrice * rate).toFixed(6), - ratio: groupRatio, - ratioType: ratioLabel, - }, - ) - : '', - fileSearch && fileSearchCallCount > 0 - ? i18next.t( - ' + 文件搜索 {{count}}次 / 1K 次 * {{symbol}}{{price}} * {{ratioType}} {{ratio}}', - { - count: fileSearchCallCount, - symbol: symbol, - price: (fileSearchPrice * rate).toFixed(6), - ratio: groupRatio, - ratioType: ratioLabel, - }, - ) - : '', - imageGenerationCall && imageGenerationCallPrice > 0 - ? i18next.t( - ' + 图片生成调用 {{symbol}}{{price}} / 1次 * {{ratioType}} {{ratio}}', - { - symbol: symbol, - price: (imageGenerationCallPrice * rate).toFixed(6), - ratio: groupRatio, - ratioType: ratioLabel, - }, - ) - : '', - ].join(''); - - return i18next.t( - '{{inputDesc}} + {{outputDesc}}{{extraServices}} = {{symbol}}{{total}}', - { - inputDesc, - outputDesc, - extraServices, - symbol, - total: (price * rate).toFixed(6), - }, - ); - })()} -
-{i18next.t('仅供参考,以实际扣费为准')}
-- {[ - i18next.t('模型倍率 {{modelRatio}}', { - modelRatio: modelRatioValue, - }), - i18next.t('补全倍率 {{completionRatio}}', { - completionRatio: completionRatioValue, - }), - cacheInputTokens > 0 - ? i18next.t('缓存倍率 {{cacheRatio}}', { - cacheRatio: cacheRatioValue, - }) - : null, - imageInputTokens > 0 - ? i18next.t('图片倍率 {{imageRatio}}', { - imageRatio: imageRatioValue, - }) - : null, - audioRatioValue !== null - ? i18next.t('音频倍率 {{audioRatio}}', { - audioRatio: audioRatioValue, - }) - : null, - i18next.t('{{ratioType}} {{ratio}}', { - ratioType: ratioLabel, - ratio: groupRatio, - }), - ] - .filter(Boolean) - .join(',')} -
- {textInputTokens > 0 && ( -- {i18next.t( - '普通输入:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: textInputTokens, - modelRatio: modelRatioValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd(textInputAmount), - }, - )} -
- )} - {cacheInputTokens > 0 && ( -- {i18next.t( - '缓存输入:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * 缓存倍率 {{cacheRatio}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: cacheInputTokens, - modelRatio: modelRatioValue, - cacheRatio: cacheRatioValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd(cacheInputAmount), - }, - )} -
- )} - {imageInputTokens > 0 && ( -- {i18next.t( - '图片输入:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * 图片倍率 {{imageRatio}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: imageInputTokens, - modelRatio: modelRatioValue, - imageRatio: imageRatioValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd(imageInputAmount), - }, - )} -
- )} - {audioInputTokens > 0 && audioRatioValue !== null && ( -- {i18next.t( - '音频输入:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * 音频倍率 {{audioRatio}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: audioInputTokens, - modelRatio: modelRatioValue, - audioRatio: audioRatioValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd(audioInputAmount), - }, - )} -
- )} -- {i18next.t( - '输出:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * 补全倍率 {{completionRatio}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: completionTokens, - modelRatio: modelRatioValue, - completionRatio: completionRatioValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd(completionAmount), - }, - )} -
- {webSearch && webSearchCallCount > 0 && ( -- {i18next.t( - 'Web 搜索:{{count}} / 1K * 单价 {{price}} * {{ratioType}} {{ratio}} = {{amount}}', - { - count: webSearchCallCount, - price: renderDisplayAmountFromUsd(webSearchPrice), - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd(webSearchAmount), - }, - )} -
- )} - {fileSearch && fileSearchCallCount > 0 && ( -- {i18next.t( - '文件搜索:{{count}} / 1K * 单价 {{price}} * {{ratioType}} {{ratio}} = {{amount}}', - { - count: fileSearchCallCount, - price: renderDisplayAmountFromUsd(fileSearchPrice), - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd(fileSearchAmount), - }, - )} -
- )} - {imageGenerationCall && imageGenerationCallPrice > 0 && ( -- {i18next.t( - '图片生成:1 次 * 单价 {{price}} * {{ratioType}} {{ratio}} = {{amount}}', - { - price: renderDisplayAmountFromUsd(imageGenerationCallPrice), - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd(imageGenerationAmount), - }, - )} -
- )} -- {i18next.t('合计:{{total}}', { - total: renderDisplayAmountFromUsd(totalAmount), - })} -
-{i18next.t('仅供参考,以实际扣费为准')}
-- {i18next.t('模型价格:{{symbol}}{{price}} / 次', { - symbol, - price: (modelPrice * rate).toFixed(6), - })} -
-- {i18next.t( - '模型价格 {{symbol}}{{price}} / 次 * {{ratioType}} {{ratio}} = {{symbol}}{{total}}', - { - symbol, - price: (modelPrice * rate).toFixed(6), - ratioType: ratioLabel, - ratio: groupRatio, - total: (modelPrice * groupRatio * rate).toFixed(6), - }, - )} -
-{i18next.t('仅供参考,以实际扣费为准')}
-- {i18next.t('输入价格:{{symbol}}{{price}} / 1M tokens', { + return renderBillingArticle([ + buildBillingPriceText('输入价格:{{symbol}}{{price}} / 1M tokens', { + symbol, + usdAmount: inputRatioPrice, + rate, + }), + buildBillingPriceText('输出价格:{{symbol}}{{price}} / 1M tokens', { + symbol, + usdAmount: completionRatioPrice, + rate, + }), + cacheTokens > 0 + ? buildBillingPriceText( + '缓存读取价格:{{symbol}}{{price}} / 1M tokens', + { symbol, - price: (inputRatioPrice * rate).toFixed(6), - })} -
-- {i18next.t('补全价格:{{symbol}}{{price}} / 1M tokens', { - symbol, - price: (completionRatioPrice * rate).toFixed(6), - })} -
- {cacheTokens > 0 && ( -- {i18next.t('缓存读取价格:{{symbol}}{{price}} / 1M tokens', { - symbol, - price: (inputRatioPrice * cacheRatio * rate).toFixed(6), - })} -
- )} -- {i18next.t('音频输入价格:{{symbol}}{{price}} / 1M tokens', { - symbol, - price: (inputRatioPrice * audioRatio * rate).toFixed(6), - })} -
-- {i18next.t('音频补全价格:{{symbol}}{{price}} / 1M tokens', { - symbol, - price: ( - inputRatioPrice * - audioRatio * - audioCompletionRatio * - rate - ).toFixed(6), - })} -
-- {i18next.t( - '文字提示 {{input}} tokens / 1M tokens * {{symbol}}{{textInputPrice}} + 文字补全 {{completion}} tokens / 1M tokens * {{symbol}}{{textCompPrice}} + 音频提示 {{audioInput}} tokens / 1M tokens * {{symbol}}{{audioInputPrice}} + 音频补全 {{audioCompletion}} tokens / 1M tokens * {{symbol}}{{audioCompPrice}} * {{ratioType}} {{ratio}} = {{symbol}}{{total}}', - { - input: inputTokens, - completion: completionTokens, - audioInput: audioInputTokens, - audioCompletion: audioCompletionTokens, - textInputPrice: (inputRatioPrice * rate).toFixed(6), - textCompPrice: (completionRatioPrice * rate).toFixed(6), - audioInputPrice: (audioRatio * inputRatioPrice * rate).toFixed(6), - audioCompPrice: ( - audioRatio * - audioCompletionRatio * - inputRatioPrice * - rate - ).toFixed(6), - ratioType: ratioLabel, - ratio: groupRatio, - symbol, - total: (totalPrice * rate).toFixed(6), - }, - )} -
-{i18next.t('仅供参考,以实际扣费为准')}
-- {i18next.t( - '模型倍率 {{modelRatio}},补全倍率 {{completionRatio}},音频倍率 {{audioRatio}},音频补全倍率 {{audioCompletionRatio}},{{cachePart}}{{ratioType}} {{ratio}}', - { - modelRatio: modelRatioValue, - completionRatio: completionRatioValue, - audioRatio: audioRatioValue, - audioCompletionRatio: audioCompletionRatioValue, - cachePart: - cacheTokens > 0 - ? `${i18next.t('缓存倍率')} ${cacheRatioValue},` - : '', - ratioType: ratioLabel, - ratio: groupRatio, - }, - )} -
-- {i18next.t( - '普通输入:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: Math.max(inputTokens - cacheTokens, 0), - modelRatio: modelRatioValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd( - ((Math.max(inputTokens - cacheTokens, 0) / 1000000) * - inputRatioPrice * - groupRatio), - ), - }, - )} -
- {cacheTokens > 0 && ( -- {i18next.t( - '缓存输入:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * 缓存倍率 {{cacheRatio}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: cacheTokens, - modelRatio: modelRatioValue, - cacheRatio: cacheRatioValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd( - ((cacheTokens / 1000000) * - inputRatioPrice * - cacheRatioValue * - groupRatio), - ), - }, - )} -
- )} -- {i18next.t( - '文字输出:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * 补全倍率 {{completionRatio}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: completionTokens, - modelRatio: modelRatioValue, - completionRatio: completionRatioValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd( - ((completionTokens / 1000000) * - inputRatioPrice * - completionRatioValue * - groupRatio), - ), - }, - )} -
-- {i18next.t( - '音频输入:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * 音频倍率 {{audioRatio}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: audioInputTokens, - modelRatio: modelRatioValue, - audioRatio: audioRatioValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd( - ((audioInputTokens / 1000000) * - inputRatioPrice * - audioRatioValue * - groupRatio), - ), - }, - )} -
-- {i18next.t( - '音频输出:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * 音频倍率 {{audioRatio}} * 音频补全倍率 {{audioCompletionRatio}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: audioCompletionTokens, - modelRatio: modelRatioValue, - audioRatio: audioRatioValue, - audioCompletionRatio: audioCompletionRatioValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd( - ((audioCompletionTokens / 1000000) * - inputRatioPrice * - audioRatioValue * - audioCompletionRatioValue * - groupRatio), - ), - }, - )} -
-- {i18next.t( - '合计:文字部分 {{textTotal}} + 音频部分 {{audioTotal}} = {{total}}', - { - textTotal: renderDisplayAmountFromUsd(textPrice), - audioTotal: renderDisplayAmountFromUsd(audioPrice), - total: renderDisplayAmountFromUsd(totalPrice), - }, - )} -
-{i18next.t('仅供参考,以实际扣费为准')}
-- {i18next.t('模型价格:{{symbol}}{{price}} / 次', { - symbol, - price: (modelPrice * rate).toFixed(6), - })} -
-- {i18next.t( - '模型价格 {{symbol}}{{price}} / 次 * {{ratioType}} {{ratio}} = {{symbol}}{{total}}', - { - symbol, - price: (modelPrice * rate).toFixed(6), - ratioType: ratioLabel, - ratio: groupRatio, - total: (modelPrice * groupRatio * rate).toFixed(6), - }, - )} -
-{i18next.t('仅供参考,以实际扣费为准')}
-- {i18next.t('输入价格:{{symbol}}{{price}} / 1M tokens', { + return renderBillingArticle([ + buildBillingPriceText('输入价格:{{symbol}}{{price}} / 1M tokens', { + symbol, + usdAmount: inputRatioPrice, + rate, + }), + buildBillingPriceText('输出价格:{{symbol}}{{price}} / 1M tokens', { + symbol, + usdAmount: completionRatioPrice, + rate, + }), + cacheTokens > 0 + ? buildBillingPriceText( + '缓存读取价格:{{symbol}}{{price}} / 1M tokens', + { symbol, - price: (inputRatioPrice * rate).toFixed(6), - })} -
-- {i18next.t('补全价格:{{symbol}}{{price}} / 1M tokens', { + usdAmount: cacheRatioPrice, + rate, + }, + ) + : null, + !hasSplitCacheCreation && cacheCreationTokens > 0 + ? buildBillingPriceText( + '缓存创建价格:{{symbol}}{{price}} / 1M tokens', + { symbol, - price: (completionRatioPrice * rate).toFixed(6), - })} -
- {cacheTokens > 0 && ( -- {i18next.t('缓存读取价格:{{symbol}}{{price}} / 1M tokens', { - symbol, - price: (cacheRatioPrice * rate).toFixed(6), - })} -
- )} - {!hasSplitCacheCreation && cacheCreationTokens > 0 && ( -- {i18next.t('缓存创建价格:{{symbol}}{{price}} / 1M tokens', { - symbol, - price: (cacheCreationRatioPrice * rate).toFixed(6), - })} -
- )} - {hasSplitCacheCreation && cacheCreationTokens5m > 0 && ( -- {i18next.t('5m缓存创建价格:{{symbol}}{{price}} / 1M tokens', { - symbol, - price: (cacheCreationRatioPrice5m * rate).toFixed(6), - })} -
- )} - {hasSplitCacheCreation && cacheCreationTokens1h > 0 && ( -- {i18next.t('1h缓存创建价格:{{symbol}}{{price}} / 1M tokens', { - symbol, - price: (cacheCreationRatioPrice1h * rate).toFixed(6), - })} -
- )} -- {i18next.t( - '{{breakdown}} * {{ratioType}} {{ratio}} = {{symbol}}{{total}}', - { - breakdown: breakdownText, - ratioType: ratioLabel, - ratio: groupRatio, - symbol, - total: (price * rate).toFixed(6), - }, - )} -
-{i18next.t('仅供参考,以实际扣费为准')}
-- {i18next.t( - '模型倍率 {{modelRatio}},输出倍率 {{completionRatio}},缓存倍率 {{cacheRatio}},{{ratioType}} {{ratio}}', - { - modelRatio: modelRatioValue, - completionRatio: completionRatioValue, - cacheRatio: cacheRatioValue, - ratioType: ratioLabel, - ratio: groupRatio, - }, - )} -
-- {hasSplitCacheCreation - ? i18next.t( - '缓存创建倍率 5m {{cacheCreationRatio5m}} / 1h {{cacheCreationRatio1h}}', - { - cacheCreationRatio5m: cacheCreationRatio5mValue, - cacheCreationRatio1h: cacheCreationRatio1hValue, - }, - ) - : i18next.t('缓存创建倍率 {{cacheCreationRatio}}', { - cacheCreationRatio: cacheCreationRatioValue, - })} -
-- {i18next.t( - '普通输入:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: inputTokens, - modelRatio: modelRatioValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd( - ((inputTokens / 1000000) * inputRatioPrice * groupRatio), - ), - }, - )} -
- {shouldShowCache && ( -- {i18next.t( - '缓存读取:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * 缓存倍率 {{cacheRatio}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: cacheTokens, - modelRatio: modelRatioValue, - cacheRatio: cacheRatioValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd( - ((cacheTokens / 1000000) * - inputRatioPrice * - cacheRatioValue * - groupRatio), - ), - }, - )} -
- )} - {shouldShowLegacyCacheCreation && ( -- {i18next.t( - '缓存创建:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * 缓存创建倍率 {{cacheCreationRatio}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: cacheCreationTokens, - modelRatio: modelRatioValue, - cacheCreationRatio: cacheCreationRatioValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd( - ((cacheCreationTokens / 1000000) * - inputRatioPrice * - cacheCreationRatioValue * - groupRatio), - ), - }, - )} -
- )} - {shouldShowCacheCreation5m && ( -- {i18next.t( - '5m缓存创建:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * 5m缓存创建倍率 {{cacheCreationRatio5m}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: cacheCreationTokens5m, - modelRatio: modelRatioValue, - cacheCreationRatio5m: cacheCreationRatio5mValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd( - ((cacheCreationTokens5m / 1000000) * - inputRatioPrice * - cacheCreationRatio5mValue * - groupRatio), - ), - }, - )} -
- )} - {shouldShowCacheCreation1h && ( -- {i18next.t( - '1h缓存创建:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * 1h缓存创建倍率 {{cacheCreationRatio1h}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: cacheCreationTokens1h, - modelRatio: modelRatioValue, - cacheCreationRatio1h: cacheCreationRatio1hValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd( - ((cacheCreationTokens1h / 1000000) * - inputRatioPrice * - cacheCreationRatio1hValue * - groupRatio), - ), - }, - )} -
- )} -- {i18next.t('补全 {{completion}} tokens * 输出倍率 {{completionRatio}}', { - completion: completionTokens, - completionRatio: completionRatioValue, - })} -
-- {i18next.t( - '输出:{{tokens}} / 1M * 模型倍率 {{modelRatio}} * 输出倍率 {{completionRatio}} * {{ratioType}} {{ratio}} = {{amount}}', - { - tokens: completionTokens, - modelRatio: modelRatioValue, - completionRatio: completionRatioValue, - ratioType: ratioLabel, - ratio: groupRatio, - amount: renderDisplayAmountFromUsd( - ((completionTokens / 1000000) * - inputRatioPrice * - completionRatioValue * - groupRatio), - ), - }, - )} -
-- {i18next.t('合计:{{total}}', { - total: renderDisplayAmountFromUsd(totalAmount), - }, - )} -
-{i18next.t('仅供参考,以实际扣费为准')}
-