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 }