From ebe9e31de9b4b49c1bd285925d990af1c2451077 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Mon, 12 May 2025 12:22:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=80=9A=E4=B9=89=E5=8F=8Aop?= =?UTF-8?q?enai=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/generalModel/openai.go | 4 +++- service/tongyi.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/service/generalModel/openai.go b/service/generalModel/openai.go index 0c2ab57..b8dc5d1 100644 --- a/service/generalModel/openai.go +++ b/service/generalModel/openai.go @@ -57,7 +57,9 @@ func OpenAI(modelParam proto.ModelParam, imCtx *proto.IMParamContext, platform s chunk.Created = -1 // 这里由于没有返回结束标志,所以用该字段来判断 } if len(chunk.Choices) > 0 { - println(chunk.Choices[0].Delta.Content) + if proto.Config.LOG_OUTPUT { + log.Printf("openai_%s stream msg:%s\n", platform, chunk.Choices[0].Delta.Content) + } answer += chunk.Choices[0].Delta.Content tokens = chunk.Usage.TotalTokens PromptTokens = chunk.Usage.PromptTokens diff --git a/service/tongyi.go b/service/tongyi.go index 53bbba5..7f7e50f 100644 --- a/service/tongyi.go +++ b/service/tongyi.go @@ -48,7 +48,9 @@ func Tongyi(modelParam proto.ModelParam, imCtx *proto.IMParamContext) { chunk.Created = -1 // 这里由于没有返回结束标志,所以用该字段来判断 } if len(chunk.Choices) > 0 { - println(chunk.Choices[0].Delta.Content) + if proto.Config.LOG_OUTPUT { + log.Printf("tongyi stream msg:%s\n", chunk.Choices[0].Delta.Content) + } answer += chunk.Choices[0].Delta.Content tokens = chunk.Usage.TotalTokens PromptTokens = chunk.Usage.PromptTokens