Merge branch 'upstream/main'

This commit is contained in:
Laisky.Cai
2025-02-01 13:17:28 +00:00
49 changed files with 3875 additions and 1600 deletions

View File

@@ -287,11 +287,14 @@ func ConsumeToken(c *gin.Context) {
return
}
model.RecordConsumeLog(c.Request.Context(),
userID, 0, 0, 0, tokenPatch.AddReason, cleanToken.Name,
int64(tokenPatch.AddUsedQuota),
fmt.Sprintf("External (%s) consumed %s",
tokenPatch.AddReason, common.LogQuota(int64(tokenPatch.AddUsedQuota))))
model.RecordConsumeLog(c.Request.Context(), &model.Log{
UserId: userID,
ModelName: tokenPatch.AddReason,
TokenName: cleanToken.Name,
Quota: int(tokenPatch.AddUsedQuota),
Content: fmt.Sprintf("External (%s) consumed %s",
tokenPatch.AddReason, common.LogQuota(int64(tokenPatch.AddUsedQuota))),
})
err = cleanToken.Update()
if err != nil {