fix: error status code nil

This commit is contained in:
ckt1031 2023-07-31 18:32:09 +08:00
parent 77458328bc
commit fd5b3d11a6

View File

@ -305,7 +305,8 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
isStream = strings.HasPrefix(resp.Header.Get("Content-Type"), "text/event-stream") isStream = strings.HasPrefix(resp.Header.Get("Content-Type"), "text/event-stream")
} }
if resp.StatusCode != http.StatusOK { if resp.StatusCode != http.StatusOK {
return errorWrapper(nil, "bad_status_code", resp.StatusCode) return errorWrapper(
fmt.Errorf("bad status code: %d", resp.StatusCode), "bad_status_code", resp.StatusCode)
} }
var textResponse TextResponse var textResponse TextResponse