From 49ea44c65b661a56b8cff5d613614d4b3ad93d8b Mon Sep 17 00:00:00 2001 From: wood Date: Sat, 11 Nov 2023 02:05:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E4=BF=AE=E6=94=B9=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/relay-text.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controller/relay-text.go b/controller/relay-text.go index fa980ab4..54b56093 100644 --- a/controller/relay-text.go +++ b/controller/relay-text.go @@ -435,11 +435,14 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode { common.LogError(ctx, "error update user quota cache: "+err.Error()) } if quota != 0 { - logContent := fmt.Sprintf("模型倍率 %.2f", modelRatio) + // 对modelRatio进行计算 + modelRatio = modelRatio * 0.002 + logContent := fmt.Sprintf("单价 $%.4f/1k tokens,补全与官方一致", modelRatio) model.RecordConsumeLog(ctx, userId, channelId, promptTokens, completionTokens, textRequest.Model, tokenName, quota, logContent) model.UpdateUserUsedQuotaAndRequestCount(userId, quota) model.UpdateChannelUsedQuota(channelId, quota) } + } }() }(c.Request.Context())