fix: responses cache token 未计费
This commit is contained in:
@@ -40,6 +40,7 @@ func OaiResponsesHandler(c *gin.Context, info *relaycommon.RelayInfo, resp *http
|
|||||||
usage.PromptTokens = responsesResponse.Usage.InputTokens
|
usage.PromptTokens = responsesResponse.Usage.InputTokens
|
||||||
usage.CompletionTokens = responsesResponse.Usage.OutputTokens
|
usage.CompletionTokens = responsesResponse.Usage.OutputTokens
|
||||||
usage.TotalTokens = responsesResponse.Usage.TotalTokens
|
usage.TotalTokens = responsesResponse.Usage.TotalTokens
|
||||||
|
usage.PromptTokensDetails.CachedTokens = responsesResponse.Usage.InputTokensDetails.CachedTokens
|
||||||
// 解析 Tools 用量
|
// 解析 Tools 用量
|
||||||
for _, tool := range responsesResponse.Tools {
|
for _, tool := range responsesResponse.Tools {
|
||||||
info.ResponsesUsageInfo.BuiltInTools[common.Interface2String(tool["type"])].CallCount++
|
info.ResponsesUsageInfo.BuiltInTools[common.Interface2String(tool["type"])].CallCount++
|
||||||
|
|||||||
@@ -1156,6 +1156,7 @@ export function renderLogContent(
|
|||||||
modelPrice = -1,
|
modelPrice = -1,
|
||||||
groupRatio,
|
groupRatio,
|
||||||
user_group_ratio,
|
user_group_ratio,
|
||||||
|
cacheRatio = 1.0,
|
||||||
image = false,
|
image = false,
|
||||||
imageRatio = 1.0,
|
imageRatio = 1.0,
|
||||||
webSearch = false,
|
webSearch = false,
|
||||||
@@ -1174,9 +1175,10 @@ export function renderLogContent(
|
|||||||
} else {
|
} else {
|
||||||
if (image) {
|
if (image) {
|
||||||
return i18next.t(
|
return i18next.t(
|
||||||
'模型倍率 {{modelRatio}},输出倍率 {{completionRatio}},图片输入倍率 {{imageRatio}},{{ratioType}} {{ratio}}',
|
'模型倍率 {{modelRatio}},缓存倍率 {{cacheRatio}},输出倍率 {{completionRatio}},图片输入倍率 {{imageRatio}},{{ratioType}} {{ratio}}',
|
||||||
{
|
{
|
||||||
modelRatio: modelRatio,
|
modelRatio: modelRatio,
|
||||||
|
cacheRatio: cacheRatio,
|
||||||
completionRatio: completionRatio,
|
completionRatio: completionRatio,
|
||||||
imageRatio: imageRatio,
|
imageRatio: imageRatio,
|
||||||
ratioType: ratioLabel,
|
ratioType: ratioLabel,
|
||||||
@@ -1185,9 +1187,10 @@ export function renderLogContent(
|
|||||||
);
|
);
|
||||||
} else if (webSearch) {
|
} else if (webSearch) {
|
||||||
return i18next.t(
|
return i18next.t(
|
||||||
'模型倍率 {{modelRatio}},输出倍率 {{completionRatio}},{{ratioType}} {{ratio}},Web 搜索调用 {{webSearchCallCount}} 次',
|
'模型倍率 {{modelRatio}},缓存倍率 {{cacheRatio}},输出倍率 {{completionRatio}},{{ratioType}} {{ratio}},Web 搜索调用 {{webSearchCallCount}} 次',
|
||||||
{
|
{
|
||||||
modelRatio: modelRatio,
|
modelRatio: modelRatio,
|
||||||
|
cacheRatio: cacheRatio,
|
||||||
completionRatio: completionRatio,
|
completionRatio: completionRatio,
|
||||||
ratioType: ratioLabel,
|
ratioType: ratioLabel,
|
||||||
ratio,
|
ratio,
|
||||||
@@ -1196,9 +1199,10 @@ export function renderLogContent(
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return i18next.t(
|
return i18next.t(
|
||||||
'模型倍率 {{modelRatio}},输出倍率 {{completionRatio}},{{ratioType}} {{ratio}}',
|
'模型倍率 {{modelRatio}},缓存倍率 {{cacheRatio}},输出倍率 {{completionRatio}},{{ratioType}} {{ratio}}',
|
||||||
{
|
{
|
||||||
modelRatio: modelRatio,
|
modelRatio: modelRatio,
|
||||||
|
cacheRatio: cacheRatio,
|
||||||
completionRatio: completionRatio,
|
completionRatio: completionRatio,
|
||||||
ratioType: ratioLabel,
|
ratioType: ratioLabel,
|
||||||
ratio,
|
ratio,
|
||||||
|
|||||||
@@ -366,6 +366,7 @@ export const useLogsData = () => {
|
|||||||
other.model_price,
|
other.model_price,
|
||||||
other.group_ratio,
|
other.group_ratio,
|
||||||
other?.user_group_ratio,
|
other?.user_group_ratio,
|
||||||
|
other.cache_ratio || 1.0,
|
||||||
false,
|
false,
|
||||||
1.0,
|
1.0,
|
||||||
other.web_search || false,
|
other.web_search || false,
|
||||||
|
|||||||
Reference in New Issue
Block a user