mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-19 08:56:37 +08:00
优化gpt-4-gizmo-*日志
This commit is contained in:
parent
3475643257
commit
1c06bddafe
@ -486,6 +486,7 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
common.LogError(ctx, "error update user quota cache: "+err.Error())
|
common.LogError(ctx, "error update user quota cache: "+err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// record all the consume log even if quota is 0
|
// record all the consume log even if quota is 0
|
||||||
useTimeSeconds := time.Now().Unix() - startTime.Unix()
|
useTimeSeconds := time.Now().Unix() - startTime.Unix()
|
||||||
var logContent string
|
var logContent string
|
||||||
@ -494,7 +495,13 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
|
|||||||
} else {
|
} else {
|
||||||
logContent = fmt.Sprintf("模型价格 %.2f,分组倍率 %.2f,用时 %d秒", modelPrice, groupRatio, useTimeSeconds)
|
logContent = fmt.Sprintf("模型价格 %.2f,分组倍率 %.2f,用时 %d秒", modelPrice, groupRatio, useTimeSeconds)
|
||||||
}
|
}
|
||||||
model.RecordConsumeLog(ctx, userId, channelId, promptTokens, completionTokens, textRequest.Model, tokenName, quota, logContent, tokenId, userQuota)
|
logModel := textRequest.Model
|
||||||
|
if strings.HasPrefix(logModel, "gpt-4-gizmo") {
|
||||||
|
logModel = "gpt-4-gizmo-*"
|
||||||
|
logContent += fmt.Sprintf(",模型 %s", textRequest.Model)
|
||||||
|
}
|
||||||
|
|
||||||
|
model.RecordConsumeLog(ctx, userId, channelId, promptTokens, completionTokens, logModel, tokenName, quota, logContent, tokenId, userQuota)
|
||||||
model.UpdateUserUsedQuotaAndRequestCount(userId, quota)
|
model.UpdateUserUsedQuotaAndRequestCount(userId, quota)
|
||||||
model.UpdateChannelUsedQuota(channelId, quota)
|
model.UpdateChannelUsedQuota(channelId, quota)
|
||||||
//if quota != 0 {
|
//if quota != 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user