From 4dadf6852e24cbf99ccc1b94190e7a16795d67cc Mon Sep 17 00:00:00 2001 From: JustSong Date: Wed, 12 Jun 2024 23:49:47 +0800 Subject: [PATCH] fix: fix panic --- relay/adaptor/xunfei/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/relay/adaptor/xunfei/main.go b/relay/adaptor/xunfei/main.go index 04fc3a64..00122d5e 100644 --- a/relay/adaptor/xunfei/main.go +++ b/relay/adaptor/xunfei/main.go @@ -5,6 +5,7 @@ import ( "crypto/sha256" "encoding/base64" "encoding/json" + "errors" "fmt" "io" "net/http" @@ -201,7 +202,7 @@ func Handler(c *gin.Context, meta *meta.Meta, textRequest model.GeneralOpenAIReq } } if len(xunfeiResponse.Payload.Choices.Text) == 0 { - return openai.ErrorWrapper(err, "xunfei_empty_response_detected", http.StatusInternalServerError), nil + return openai.ErrorWrapper(errors.New("xunfei empty response detected"), "xunfei_empty_response_detected", http.StatusInternalServerError), nil } xunfeiResponse.Payload.Choices.Text[0].Content = content