fix: fix error response (close #468)

This commit is contained in:
JustSong
2023-08-26 12:37:45 +08:00
parent ac7c0f3a76
commit a3e267df7e
2 changed files with 31 additions and 2 deletions

View File

@@ -317,8 +317,7 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
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)
return relayErrorHandler(resp)
}
}