From 02a918b149369997d58be35e36e164e7fd071d26 Mon Sep 17 00:00:00 2001 From: Yanyutin753 <132346501+Yanyutin753@users.noreply.github.com> Date: Sat, 16 Mar 2024 17:35:37 +0800 Subject: [PATCH] fix only extract and record the most critical part. Because sometimes when certain models transfer files, the error information here becomes too long, leading to very large log sizes. Therefore, I hope that only the most critical parts are extracted and recorded when an error is logged here. --- relay/channel/openai/token.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/relay/channel/openai/token.go b/relay/channel/openai/token.go index 0720425f..984ef4e8 100644 --- a/relay/channel/openai/token.go +++ b/relay/channel/openai/token.go @@ -102,7 +102,8 @@ func CountTokenMessages(messages []model.Message, model string) int { } imageTokens, err := countImageTokens(url, detail) if err != nil { - logger.SysError("error counting image tokens: " + err.Error()) + //Due to the excessive length of the error information, only extract and record the most critical part. + logger.SysError(fmt.Sprintf("error counting image tokens. Error type: %T", err)) } else { tokenNum += imageTokens }