fix(openai): preserve multiline repaired SSE data

This commit is contained in:
edlsh
2026-04-25 18:12:27 -04:00
parent d36e70e9dc
commit 80eb03709a
2 changed files with 40 additions and 3 deletions
@@ -148,9 +148,12 @@ func responsesSSEFrameWithData(frame, payload []byte) []byte {
out.Write(line)
out.WriteByte('\n')
}
out.WriteString("data: ")
out.Write(payload)
out.WriteString("\n\n")
for _, line := range bytes.Split(payload, []byte("\n")) {
out.WriteString("data: ")
out.Write(line)
out.WriteByte('\n')
}
out.WriteByte('\n')
return out.Bytes()
}