add markdown
This commit is contained in:
@@ -40,7 +40,7 @@ export const Chat: FC<Props> = ({ model, messages, loading, onSend, onSelect })
|
||||
) : (
|
||||
<>
|
||||
<div className="flex-1 overflow-auto">
|
||||
<div className="text-center py-3 dark:bg-[#434654] dark:text-neutral-300 text-neutral-500 text-sm border border-b-neutral-300 dark:border-none">Model: {OpenAIModelNames[model]}</div>
|
||||
<div className="text-center py-3 dark:bg-[#444654] dark:text-neutral-300 text-neutral-500 text-sm border border-b-neutral-300 dark:border-none">Model: {OpenAIModelNames[model]}</div>
|
||||
|
||||
{messages.map((message, index) => (
|
||||
<div key={index}>
|
||||
|
||||
@@ -6,7 +6,7 @@ interface Props {}
|
||||
export const ChatLoader: FC<Props> = () => {
|
||||
return (
|
||||
<div
|
||||
className={`flex justify-center px-[120px] py-[30px] whitespace-pre-wrap dark:bg-[#434654] dark:text-neutral-100 bg-neutral-100 text-neutral-900 dark:border-none"`}
|
||||
className={`flex justify-center px-[120px] py-[30px] whitespace-pre-wrap dark:bg-[#444654] dark:text-neutral-100 bg-neutral-100 text-neutral-900 dark:border-none"`}
|
||||
style={{ overflowWrap: "anywhere" }}
|
||||
>
|
||||
<div className="w-[650px] flex">
|
||||
|
||||
@@ -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