fix: empty completion issue caused by bad status code from upstream channel (#422)

This commit is contained in:
Benny 2023-08-19 17:58:45 +08:00 committed by ckt1031
parent e556a23b19
commit 3ca910917c

View File

@ -321,6 +321,11 @@ func relayTextHelper(c *gin.Context, relayMode int) *OpenAIErrorWithStatusCode {
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
tokenName := c.GetString("token_name")
channelId := c.GetInt("channel_id")