From efeb9a16ceb8b9e88560fc68ba4a528e1982f76d Mon Sep 17 00:00:00 2001 From: glzjin Date: Sun, 20 Aug 2023 22:07:50 +0800 Subject: [PATCH] fix: fix xunfei crash (#451) --- controller/relay-text.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/controller/relay-text.go b/controller/relay-text.go index 6ebe75e9..0bad948f 100644 --- a/controller/relay-text.go +++ b/controller/relay-text.go @@ -315,11 +315,11 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode { return errorWrapper(err, "close_request_body_failed", http.StatusInternalServerError) } isStream = isStream || strings.HasPrefix(resp.Header.Get("Content-Type"), "text/event-stream") - } - if resp.StatusCode != http.StatusOK { - return errorWrapper( - fmt.Errorf("bad status code: %d", resp.StatusCode), "bad_status_code", resp.StatusCode) + if resp.StatusCode != http.StatusOK { + return errorWrapper( + fmt.Errorf("bad status code: %d", resp.StatusCode), "bad_status_code", resp.StatusCode) + } } var textResponse TextResponse