|
|
@@ -150,12 +150,14 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
|
|
|
if err != nil {
|
|
|
common.SysError("error consuming token remain quota: " + err.Error())
|
|
|
}
|
|
|
- tokenName := c.GetString("token_name")
|
|
|
- logContent := fmt.Sprintf("模型倍率 %.2f,分组倍率 %.2f", modelRatio, groupRatio)
|
|
|
- model.RecordConsumeLog(userId, promptTokens, completionTokens, textRequest.Model, tokenName, quota, logContent)
|
|
|
- model.UpdateUserUsedQuotaAndRequestCount(userId, quota)
|
|
|
- channelId := c.GetInt("channel_id")
|
|
|
- model.UpdateChannelUsedQuota(channelId, quota)
|
|
|
+ if quota != 0 {
|
|
|
+ tokenName := c.GetString("token_name")
|
|
|
+ logContent := fmt.Sprintf("模型倍率 %.2f,分组倍率 %.2f", modelRatio, groupRatio)
|
|
|
+ model.RecordConsumeLog(userId, promptTokens, completionTokens, textRequest.Model, tokenName, quota, logContent)
|
|
|
+ model.UpdateUserUsedQuotaAndRequestCount(userId, quota)
|
|
|
+ channelId := c.GetInt("channel_id")
|
|
|
+ model.UpdateChannelUsedQuota(channelId, quota)
|
|
|
+ }
|
|
|
}
|
|
|
}()
|
|
|
|