nlkitai/nlux

Issue with rendering back from history code blocks

mstfash opened this issue · 9 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!

Anything regarding that ?

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.

jlev commented

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 — 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.

  • 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:

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

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!

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.

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

Issues here fixed in latest v2 and later:

  • Now we use the same markdown parser for both streaming and history, so markdown should be consistent
  • Typing effect remove from history
  • 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)