fix: simplify responses SSE suffix handling
This commit is contained in:
@@ -32,15 +32,13 @@ func writeResponsesSSEChunk(w io.Writer, chunk []byte) {
|
||||
if bytes.HasSuffix(chunk, []byte("\n\n")) {
|
||||
return
|
||||
}
|
||||
suffix := []byte("\n\n")
|
||||
if bytes.HasSuffix(chunk, []byte("\n")) {
|
||||
if _, err := w.Write([]byte("\n")); err != nil {
|
||||
return
|
||||
suffix = []byte("\n")
|
||||
}
|
||||
} else {
|
||||
if _, err := w.Write([]byte("\n\n")); err != nil {
|
||||
if _, err := w.Write(suffix); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OpenAIResponsesAPIHandler contains the handlers for OpenAIResponses API endpoints.
|
||||
|
||||
Reference in New Issue
Block a user