feat: record used quota & request count (close #102, #165)

This commit is contained in:
JustSong
2023-06-16 15:20:06 +08:00
parent 58fb18aace
commit 760183a970
4 changed files with 43 additions and 12 deletions

View File

@@ -261,6 +261,7 @@ 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)
}
}()