fix: test
This commit is contained in:
parent
cd3d1b9f1b
commit
d384be868c
@ -79,9 +79,7 @@ func testChannel(channel *model.Channel, request ChatRequest) (err error, openai
|
|||||||
return errors.New(fmt.Sprintf("status code %d", resp.StatusCode)), nil
|
return errors.New(fmt.Sprintf("status code %d", resp.StatusCode)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
isStream := strings.HasPrefix(resp.Header.Get("Content-Type"), "text/event-stream")
|
if channel.AllowStreaming == common.ChannelAllowStreamEnabled {
|
||||||
|
|
||||||
if channel.AllowStreaming == common.ChannelAllowStreamEnabled && isStream {
|
|
||||||
responseText := ""
|
responseText := ""
|
||||||
scanner := bufio.NewScanner(resp.Body)
|
scanner := bufio.NewScanner(resp.Body)
|
||||||
scanner.Split(func(data []byte, atEOF bool) (advance int, token []byte, err error) {
|
scanner.Split(func(data []byte, atEOF bool) (advance int, token []byte, err error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user