Skip to content

ADE - Chat response formatting  #1934

@raolak

Description

@raolak

Chat messages with code and md formats are not that well handles. For quick fix we can use React MArkdown component...I did quick poc, this is how it looks. This will improve the user experience.
Screenshot 2024-10-24 at 11 39 03 PM

npm install react-markdown remark-gfm

tailwind css config
add require('@tailwindcss/typography')]
plugins: [require('tailwindcss-animate'), require('@tailwindcss/typography')],

globals.css (whatver css you are using) add prose

Example

  .prose {
    @apply max-w-none; /* Prevent Markdown from restricting width */
  }
  
  pre, code {
    @apply font-sans text-sm;
  }

code example

import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
  <ReactMarkdown remarkPlugins={[remarkGfm]} className="prose text-sm">
            {message.content}
   </ReactMarkdown>

This should be quick one for now.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions