From e7cc50d8cb971194d7db733faab92822f6ca9015 Mon Sep 17 00:00:00 2001 From: ybyang Date: Mon, 25 Nov 2024 15:49:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=AF=E9=A3=9E=E5=93=8D=E5=BA=94=20sid=20?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=A0=81=E6=8F=90=E7=A4=BA=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- relay/adaptor/xunfei/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/relay/adaptor/xunfei/main.go b/relay/adaptor/xunfei/main.go index 516bea5b..3b171b1f 100644 --- a/relay/adaptor/xunfei/main.go +++ b/relay/adaptor/xunfei/main.go @@ -10,6 +10,7 @@ import ( "io" "net/http" "net/url" + "strconv" "strings" "time" @@ -206,6 +207,10 @@ func Handler(c *gin.Context, meta *meta.Meta, textRequest model.GeneralOpenAIReq case stop = <-stopChan: } } + if xunfeiResponse.Header.Code != 0 { + return openai.ErrorWrapper(errors.New("xunfei response error: sid: "+xunfeiResponse.Header.Sid), strconv.Itoa(xunfeiResponse.Header.Code), http.StatusInternalServerError), nil + + } if len(xunfeiResponse.Payload.Choices.Text) == 0 { return openai.ErrorWrapper(errors.New("xunfei empty response detected"), "xunfei_empty_response_detected", http.StatusInternalServerError), nil }