fix: chat stream resp error (#259)

This commit is contained in:
Liu Shuang
2023-04-19 20:05:00 +08:00
committed by GitHub
parent 3b10c032b6
commit d6ab1b3a4f
8 changed files with 146 additions and 33 deletions

View File

@@ -4,6 +4,7 @@ import (
"bufio"
"context"
"errors"
"net/http"
)
var (
@@ -43,6 +44,9 @@ func (c *Client) CreateCompletionStream(
if err != nil {
return
}
if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusBadRequest {
return nil, c.handleErrorResp(resp)
}
stream = &CompletionStream{
streamReader: &streamReader[CompletionResponse]{