#Streaming EventSource not working with newline characters

2 messages · Page 1 of 1 (latest)

slow gulch
#

I am using the eventsource-parser npm package to work with streaming back responses from openai on both my backend and frontend. I make a request to my backend with the messages from my chat then I send back the responses as a stream. The problem is on my frontend when I log the value before I send it to the eventsource parser it contains characters and newline characters ex. '\n' but when I log it from the event source parser it logs correctly for normal characters but logs <empty string> for \n etc.