OvidijusParsiunas / deep-chat

Fully customizable AI chatbot component for your website
https://deepchat.dev
MIT License
1.26k stars 170 forks source link

Handling line breaks while streaming responses #180

Closed ronald888 closed 1 month ago

ronald888 commented 1 month ago

Since streaming data returns chunked text, a newline character can be split between \ and n. What's the best way to handle such a scenario? Is it possible to cache the response through the response interceptor?

OvidijusParsiunas commented 1 month ago

Hi @ronald888.

If you want to have new lines in your messages, you can add \n\n in the place where you want to have them. Let me know if this helps you.

Thanks!

OvidijusParsiunas commented 1 month ago

I will be closing this issue as there has been no further activity.

OvidijusParsiunas commented 3 weeks ago

Hi, this has now been improved and new lines will now be rendered by simply having \n in your text message. This is now available in our deep-chat-dev and deep-chat-react-dev packages version 9.0.174 and will be added to the next release of our main package (after 1.4.11).