fix dead loop while network error (#77)

This commit is contained in:
Frank Yang
2023-02-18 17:13:23 +08:00
committed by GitHub
parent 67a43e6392
commit 133d2c9184

View File

@@ -7,7 +7,6 @@ import (
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
)
@@ -27,9 +26,7 @@ func (stream *CompletionStream) Recv() (response CompletionResponse, err error)
waitForData:
line, err := stream.reader.ReadBytes('\n')
if err != nil {
if errors.Is(err, io.EOF) {
return
}
return
}
var headerData = []byte("data: ")