OvidijusParsiunas / deep-chat

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

BUG: Line breaks are not maintained in chat #165

Open tasdflkjweio opened 2 months ago

tasdflkjweio commented 2 months ago

When I type a message into that input that looks like...

This is my first line in my first paragraph....and then i start a list:
- An item
- An item
- An item

Then a new paragraph

Line breaks are removed when shown in the message area:

This is my first line in my first paragraph....and then i start a list:- An item- An item- An itemThen a new paragraph
OvidijusParsiunas commented 2 months ago

Hi @tasdflkjweio, I will investigate this bug shortly and report to you on the progress.

OvidijusParsiunas commented 2 months ago

Hi @tasdflkjweio. This issue has now been fixed in dev package versions 9.0.163.

Please note that the user message is parsed by the Remarkable library (just like the ai response messages), so the line (-) syntax will be re-formated to be a bullet point, would this be problematic?

Let me know, thanks!

tasdflkjweio commented 2 months ago

had a chaotic couple days at work so just checking this out now.

so the line (-) syntax will be re-formated to be a bullet point, would this be problematic? thanks for asking, it should be fine.

i'll test it out today and let you know soon

tasdflkjweio commented 2 months ago

Alright, tested and it's a little better but a bit off still.

Example 1:

line 1
line 2
line 3
line 4
- bullet 1
- bullet 2
line 5

is formatted as:

image

Example 2:

line 1
line 2
line 3

line 4

- bullet 1
- bullet 2

line 5

line 6
line 7

is formatted as:

image
tasdflkjweio commented 2 months ago

Ah i see - it seems Remarkable is expecting CommonMark format. Hrm

tasdflkjweio commented 2 months ago

The breaks flag seems to improve this some. Line 5 is off, but everything else seems good:

image

The second example seems better:

image

That's presumably what you've enabled tho?

OvidijusParsiunas commented 2 months ago

Hi @tasdflkjweio.

Deep Chat uses the Remarkable library's defaults to format text. This way the user will not experience any unexpected behaviour.

To note, if the parent application imports the highlight.js module as an external dependency, we specifically set the configuration to help with coding syntax.

The code can be found here.

jbrachtie commented 16 hours ago

@OvidijusParsiunas When can we expect the next update to the non-dev package? Would love to see this in deep-chat-react (as well as other fixes/improvements I've seen made to the dev package in recent months)!

OvidijusParsiunas commented 15 hours ago

Hi @jbrachtie I share your frustration and want to get the big new update out of the way ASAP! I have set myself with a deadline of 11th of July, so if nothing else jumps up in the interim - expect a big update very soon!

jbrachtie commented 15 hours ago

@OvidijusParsiunas oh wow! Great to know, and certainly understand the effort to get such a big update out. I know a lot has gone into dev since the last release. Thanks for the quick reply and very excited about the next big update :)