Commit 9985553b by JustSong

fix: fix quota not consumed

parent 7f31528d
...@@ -111,14 +111,9 @@ func TokenAuth() func(c *gin.Context) { ...@@ -111,14 +111,9 @@ func TokenAuth() func(c *gin.Context) {
c.Set("id", token.UserId) c.Set("id", token.UserId)
c.Set("token_id", token.Id) c.Set("token_id", token.Id)
requestURL := c.Request.URL.String() requestURL := c.Request.URL.String()
consumeQuota := false consumeQuota := !token.UnlimitedQuota
switch requestURL { if strings.HasPrefix(requestURL, "/models") {
case "/v1/chat/completions": consumeQuota = false
consumeQuota = !token.UnlimitedQuota
case "/v1/completions":
consumeQuota = !token.UnlimitedQuota
case "/v1/edits":
consumeQuota = !token.UnlimitedQuota
} }
c.Set("consume_quota", consumeQuota) c.Set("consume_quota", consumeQuota)
if len(parts) > 1 { if len(parts) > 1 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment