mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-08 17:53:41 +08:00
feat: show stream & elapsed time in log detail
This commit is contained in:
@@ -33,7 +33,16 @@ func PostConsumeQuota(ctx context.Context, tokenId int, quotaDelta int64, totalQ
|
||||
// totalQuota is total quota consumed
|
||||
if totalQuota != 0 {
|
||||
logContent := fmt.Sprintf("%.2f × %.2f", modelRatio, groupRatio)
|
||||
model.RecordConsumeLog(ctx, userId, channelId, int(totalQuota), 0, modelName, tokenName, totalQuota, logContent)
|
||||
model.RecordConsumeLog(ctx, &model.Log{
|
||||
UserId: userId,
|
||||
ChannelId: channelId,
|
||||
PromptTokens: int(totalQuota),
|
||||
CompletionTokens: 0,
|
||||
ModelName: modelName,
|
||||
TokenName: tokenName,
|
||||
Quota: int(totalQuota),
|
||||
Content: logContent,
|
||||
})
|
||||
model.UpdateUserUsedQuotaAndRequestCount(userId, totalQuota)
|
||||
model.UpdateChannelUsedQuota(channelId, totalQuota)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user