mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-19 00:46:37 +08:00
record all the consume log even if quota is 0
This commit is contained in:
parent
560753c61f
commit
36b0db2a3e
@ -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 {
|
||||
// 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())
|
||||
|
Loading…
Reference in New Issue
Block a user