nlux icon indicating copy to clipboard operation
nlux copied to clipboard

Issue with rendering back from history code blocks

Open mstfash opened this issue 2 years ago • 8 comments

My issue is I saved history with code blocks and md blocks but they are saved as string which is understandable, now when I render inititalConversation it just give me text without highlight syntax or code blocks, pre, code html tags is there a way from nlux to handle this ? Screenshot 2024-04-22 at 12 29 44 AM

Thanks in advance!

mstfash avatar Apr 21 '24 22:04 mstfash

Anything regarding that ?

mstfash avatar Apr 26 '24 14:04 mstfash

Hi @mstfash — Thanks for reporting this.

I have noticed the issue as well, while re-writing the React layer of NLUX.

I will fix it as part of the v2 release — expect it in a few days, mid next week.

salmenus avatar Apr 26 '24 22:04 salmenus

Is it also possible to remove the typing effect when rendering the conversation history? I'd like to save that for content that is streamed back live.

jlev avatar May 01 '24 18:05 jlev

@jlev — This is in the lastest branch, right ? Or maybe in v2.0.0-alpha.1 ?

I don't think it has been published as a stable version yet.

But yes, you're right: It should not be there.

salmenus avatar May 02 '24 09:05 salmenus

  • Initial commit here to fix the issue.
  • Initial fix can be tested in in 2.0.2-alpha
  • This is not stable and not recommended for prod yet. It should be ready to use once the stable v2.x is released.

Progress:

  • [x] Parse markdown for messages loaded via conversation history as a snapshot (vs stream)
  • [x] We do not display animation anymore
  • [x] Make snapshot markdown 100% identical to streamed markdown
  • [x] Handle advanced syntax highlighter use cases (copy button options, etc)

salmenus avatar May 02 '24 11:05 salmenus

Thanks for your support @salmenus

I have tried version 2.0.6-alpha there are a lot of changes regarding css and how AIChat used to work so I had to change a lot of my custom css to its like before anyways I have got this done, but the real issue here that popped up that Events are not doing anything, usually Events map for messageSent and messageReceived I usually get a callback with the message, suddenly both of them are not working.

Could you please look into this ?

Thanks again!

mstfash avatar May 12 '24 11:05 mstfash

hey @mstfash

  • Just done writing the events layer ✔️ — Specs here
  • Also done with other markdown-related changed ✔️

All is published in 2.0.9-alpha

Doc to follow later this week.

salmenus avatar May 13 '24 17:05 salmenus

Hey @salmenus Thank you for your fast responses and continuous support. After installing version 2.0.9-alpha and Events layer work fine so I can save messages of user and ai just fine but. when using useLocalStorage with initialConversation it renders double messages for user and ai, they disappear though when reloading the page which is understandable. but this is not a good behavior

Screenshot 2024-05-14 at 5 12 52 PM

Thanks in advance

mstfash avatar May 14 '24 14:05 mstfash

Issues here fixed in latest v2 and later:

  • [x] Now we use the same markdown parser for both streaming and history, so markdown should be consistent
  • [x] Typing effect remove from history
  • [x] The double rendering issue should be fixed in latest v2

I'll be closing this issue unless

@mstfash @jlev if you still have issues related to history reloading, please raise a separate issue and make sure you provide a reproducible example (via CodeSandbox or similar)

salmenus avatar Jun 07 '24 18:06 salmenus