Skip to content

Commit

Permalink
fix: empty completion issue caused by bad status code from upstream c…
Browse files Browse the repository at this point in the history
…hannel (#422)
  • Loading branch information
mrhaoji authored Aug 19, 2023
1 parent 7e058bf commit 05e4f2b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controller/relay-text.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ 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)
}

var textResponse TextResponse
tokenName := c.GetString("token_name")
channelId := c.GetInt("channel_id")
Expand Down

0 comments on commit 05e4f2b

Please sign in to comment.