This commit is contained in:
wood 2023-12-05 01:42:57 +08:00
parent 6b40b46651
commit 88e2e3caad

View File

@ -219,7 +219,9 @@ func postConsumeQuota(ctx context.Context, tokenId int, quotaDelta int, totalQuo
} }
// totalQuota is total quota consumed // totalQuota is total quota consumed
if totalQuota != 0 { if totalQuota != 0 {
logContent := fmt.Sprintf("模型倍率 %.2f,分组倍率 %.2f", modelRatio, groupRatio) outputPrice := modelRatio * 0.002
var logContent string
logContent = fmt.Sprintf("单价: $%.6g/1k tokens", outputPrice)
model.RecordConsumeLog(ctx, userId, channelId, totalQuota, 0, modelName, tokenName, totalQuota, logContent) model.RecordConsumeLog(ctx, userId, channelId, totalQuota, 0, modelName, tokenName, totalQuota, logContent)
model.UpdateUserUsedQuotaAndRequestCount(userId, totalQuota) model.UpdateUserUsedQuotaAndRequestCount(userId, totalQuota)
model.UpdateChannelUsedQuota(channelId, totalQuota) model.UpdateChannelUsedQuota(channelId, totalQuota)