Skip to content

Commit

Permalink
fix: fix quota not consumed
Browse files Browse the repository at this point in the history
  • Loading branch information
songquanpeng committed May 14, 2023
1 parent 976c29e commit 4a0e81f
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions middleware/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,9 @@ func TokenAuth() func(c *gin.Context) {
c.Set("id", token.UserId)
c.Set("token_id", token.Id)
requestURL := c.Request.URL.String()
consumeQuota := false
switch requestURL {
case "/v1/chat/completions":
consumeQuota = !token.UnlimitedQuota
case "/v1/completions":
consumeQuota = !token.UnlimitedQuota
case "/v1/edits":
consumeQuota = !token.UnlimitedQuota
consumeQuota := !token.UnlimitedQuota
if strings.HasPrefix(requestURL, "/models") {
consumeQuota = false
}
c.Set("consume_quota", consumeQuota)
if len(parts) > 1 {
Expand Down

0 comments on commit 4a0e81f

Please sign in to comment.