日志修改详情显示

This commit is contained in:
wood 2023-11-11 02:05:15 +08:00
parent 9bc11bde28
commit 49ea44c65b

View File

@ -435,11 +435,14 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
common.LogError(ctx, "error update user quota cache: "+err.Error())
}
if quota != 0 {
logContent := fmt.Sprintf("模型倍率 %.2f", modelRatio)
// 对modelRatio进行计算
modelRatio = modelRatio * 0.002
logContent := fmt.Sprintf("单价 $%.4f/1k tokens,补全与官方一致", modelRatio)
model.RecordConsumeLog(ctx, userId, channelId, promptTokens, completionTokens, textRequest.Model, tokenName, quota, logContent)
model.UpdateUserUsedQuotaAndRequestCount(userId, quota)
model.UpdateChannelUsedQuota(channelId, quota)
}
}
}()
}(c.Request.Context())