fix: only reduce remain times when request /v1/chat/completions (close #15)

BREAKING CHANGE: now remain_times is -1 doesn't mean unlimited times anymore!
This commit is contained in:
JustSong
2023-04-26 10:45:34 +08:00
parent eb8f43acb5
commit 109736cc05
6 changed files with 83 additions and 40 deletions

View File

@@ -80,6 +80,8 @@ func TokenAuth() func(c *gin.Context) {
return
}
c.Set("id", token.UserId)
c.Set("token_id", token.Id)
c.Set("unlimited_times", token.UnlimitedTimes)
if len(parts) > 1 {
c.Set("channelId", parts[1])
}