|
|
@@ -446,12 +446,14 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
|
|
|
if err != nil {
|
|
|
common.LogError(ctx, "error update user quota cache: "+err.Error())
|
|
|
}
|
|
|
- if quota != 0 {
|
|
|
- logContent := fmt.Sprintf("模型倍率 %.2f,分组倍率 %.2f", modelRatio, groupRatio)
|
|
|
- model.RecordConsumeLog(ctx, userId, channelId, promptTokens, completionTokens, textRequest.Model, tokenName, quota, logContent, tokenId)
|
|
|
- model.UpdateUserUsedQuotaAndRequestCount(userId, quota)
|
|
|
- model.UpdateChannelUsedQuota(channelId, quota)
|
|
|
- }
|
|
|
+ // record all the consume log even if quota is 0
|
|
|
+ logContent := fmt.Sprintf("模型倍率 %.2f,分组倍率 %.2f", modelRatio, groupRatio)
|
|
|
+ model.RecordConsumeLog(ctx, userId, channelId, promptTokens, completionTokens, textRequest.Model, tokenName, quota, logContent, tokenId)
|
|
|
+ model.UpdateUserUsedQuotaAndRequestCount(userId, quota)
|
|
|
+ model.UpdateChannelUsedQuota(channelId, quota)
|
|
|
+ //if quota != 0 {
|
|
|
+ //
|
|
|
+ //}
|
|
|
}
|
|
|
}()
|
|
|
}(c.Request.Context())
|