devflowinc / trieve

All-in-one infrastructure for search, recommendations, RAG, and analytics offered via API
https://dashboard.trieve.ai
Other
1.44k stars 123 forks source link

bugfix: in a assistant completion message, when square brackets are generated in the response, MD render does not work properly #1810

Closed jooni22 closed 2 months ago

jooni22 commented 3 months ago

Description

image When square brackets are generated in the response, the Markdown render does not work properly, and render raw HTML tags.

Target(s)

The issue affects the "chat" feature.

Requirement to close

Fix

Code snippet:

The image show a jq command that processes JSON data. It checks for specific conditions related to the "type" field and constructs HTML button elements with onclick events.

Problem visualization:

On the image highlights parts of the code in red, showing where HTML tags like and

aaryanpunia commented 2 months ago

Hi! Can you provide a sample input in text that would reproduce this issue?

aaryanpunia commented 2 months ago

can repro by setting system prompt to something like only return ```[0] ``` only happens with code elements

skeptrunedev commented 2 months ago

Let's just remove the replace logic - https://github.com/devflowinc/trieve/blob/main/frontends/chat/src/components/Atoms/AfMessage.tsx#L106-L115