mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-24 20:26:41 +08:00
fix: Refactor: Remove Quota Consumption Logic When Quota is 0
- Remove quota consumption logic when quota is 0 - Improve logging of quota usage when quota is greater than 0 - Reduce noise in logs when quota is 0
This commit is contained in:
parent
2989686ace
commit
06350ae5a2
@ -113,10 +113,15 @@ func postConsumeQuota(ctx context.Context, usage *relaymodel.Usage, meta *util.R
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(ctx, "error update user quota cache: "+err.Error())
|
logger.Error(ctx, "error update user quota cache: "+err.Error())
|
||||||
}
|
}
|
||||||
if quota != 0 {
|
// if quota != 0 {
|
||||||
|
// logContent := fmt.Sprintf("模型倍率 %.2f,分组倍率 %.2f,补全倍率 %.2f", modelRatio, groupRatio, completionRatio)
|
||||||
|
// model.RecordConsumeLog(ctx, meta.UserId, meta.ChannelId, promptTokens, completionTokens, textRequest.Model, meta.TokenName, quota, logContent)
|
||||||
|
// model.UpdateUserUsedQuotaAndRequestCount(meta.UserId, quota)
|
||||||
|
// model.UpdateChannelUsedQuota(meta.ChannelId, quota)
|
||||||
|
// }
|
||||||
|
|
||||||
logContent := fmt.Sprintf("模型倍率 %.2f,分组倍率 %.2f,补全倍率 %.2f", modelRatio, groupRatio, completionRatio)
|
logContent := fmt.Sprintf("模型倍率 %.2f,分组倍率 %.2f,补全倍率 %.2f", modelRatio, groupRatio, completionRatio)
|
||||||
model.RecordConsumeLog(ctx, meta.UserId, meta.ChannelId, promptTokens, completionTokens, textRequest.Model, meta.TokenName, quota, logContent)
|
model.RecordConsumeLog(ctx, meta.UserId, meta.ChannelId, promptTokens, completionTokens, textRequest.Model, meta.TokenName, quota, logContent)
|
||||||
model.UpdateUserUsedQuotaAndRequestCount(meta.UserId, quota)
|
model.UpdateUserUsedQuotaAndRequestCount(meta.UserId, quota)
|
||||||
model.UpdateChannelUsedQuota(meta.ChannelId, quota)
|
model.UpdateChannelUsedQuota(meta.ChannelId, quota)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user