feat: record channel's used quota (close #137)

This commit is contained in:
JustSong committed 2023-06-16 16:02:00 +08:00
1 parent 0b3efe574b
commit 8979961a83
2 files changed
+11

No files matched your search

+2
View File
@@ -262,6 +262,8 @@ func relayHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
userId := c.GetInt("id")
model.RecordLog(userId, model.LogTypeConsume, fmt.Sprintf("使用模型 %s 消耗 %d 点额度(模型倍率 %.2f,分组倍率 %.2f)", textRequest.Model, quota, modelRatio, groupRatio))
model.UpdateUserUsedQuotaAndRequestCount(userId, quota)
channelId := c.GetInt("channel_id")
model.UpdateChannelUsedQuota(channelId, quota)
}
}()