Skip to content

Commit

Permalink
markdown displaying
Browse files Browse the repository at this point in the history
  • Loading branch information
FanisNgv committed Sep 13, 2024
1 parent 8a6a590 commit 56a99e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions frontend/src/app/_components/MessageList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { motion, AnimatePresence } from 'framer-motion';
import { ScrollArea } from "@/components/ui/scroll-area"

import ReactMarkdown from 'react-markdown';

type Message = {
id: number;
Expand Down Expand Up @@ -29,7 +29,13 @@ export default function MessageList({ messages }: MessageListProps) {
<div className={`inline-block px-2 py-3 rounded-lg max-w-[70%] break-words ${
msg.sender === 'user' ? 'bg-[#5d76f7] text-white text-left' : 'bg-gray-300 text-black text-justify'
}`}>
{msg.text}
{msg.sender === 'user' ? (
msg.text
) : (
<ReactMarkdown className="markdown-content">
{msg.text}
</ReactMarkdown>
)}
</div>
</motion.div>
)
Expand Down

0 comments on commit 56a99e3

Please sign in to comment.