fix: update cached user quota after post-consuming (close #204)

This commit is contained in:
JustSong committed 2023-06-27 19:22:58 +08:00
1 parent 1ab01b7eb5
commit da94aade10
2 files changed
+16

No files matched your search

+4
View File
@@ -201,6 +201,10 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
if err != nil {
common.SysError("error consuming token remain quota: " + err.Error())
}
err = model.CacheUpdateUserQuota(userId)
if err != nil {
common.SysError("error update user quota cache: " + err.Error())
}
if quota != 0 {
tokenName := c.GetString("token_name")
logContent := fmt.Sprintf("模型倍率 %.2f,分组倍率 %.2f", modelRatio, groupRatio)