add markdown
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Message } from "@/types";
|
||||
import { FC } from "react";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
|
||||
interface Props {
|
||||
message: Message;
|
||||
@@ -8,13 +9,15 @@ interface Props {
|
||||
export const ChatMessage: FC<Props> = ({ message }) => {
|
||||
return (
|
||||
<div
|
||||
className={`flex justify-center px-[120px] py-[30px] whitespace-pre-wrap] ${message.role === "assistant" ? "dark:bg-[#434654] dark:text-neutral-100 bg-neutral-100 text-neutral-900 border border-neutral-300 dark:border-none" : "dark:bg-[#343541] dark:text-white text-neutral-900"}`}
|
||||
className={`flex justify-center px-[120px] py-[30px] whitespace-pre-wrap] ${message.role === "assistant" ? "dark:bg-[#444654] dark:text-neutral-100 bg-neutral-100 text-neutral-900 border border-neutral-300 dark:border-none" : "dark:bg-[#343541] dark:text-white text-neutral-900"}`}
|
||||
style={{ overflowWrap: "anywhere" }}
|
||||
>
|
||||
<div className="w-[650px] flex">
|
||||
<div className="w-[650px] flex align-middle">
|
||||
<div className="mr-4 font-bold min-w-[40px]">{message.role === "assistant" ? "AI:" : "You:"}</div>
|
||||
|
||||
<div className="whitespace-pre-wrap">{message.content}</div>
|
||||
<div className="prose dark:prose-invert">
|
||||
<ReactMarkdown>{message.content}</ReactMarkdown>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user