mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-14 20:37:34 +03:00
25 lines
548 B
TypeScript
25 lines
548 B
TypeScript
|
|
import ReactMarkdown from "react-markdown";
|
||
|
|
import { cn } from "@/lib/utils";
|
||
|
|
|
||
|
|
type MessageBubbleProps = {
|
||
|
|
role: "user" | "assistant";
|
||
|
|
content: string;
|
||
|
|
};
|
||
|
|
|
||
|
|
export function MessageBubble({ role, content }: MessageBubbleProps) {
|
||
|
|
const isUser = role === "user";
|
||
|
|
|
||
|
|
return (
|
||
|
|
<div
|
||
|
|
className={cn(
|
||
|
|
"rounded-lg px-3 py-2",
|
||
|
|
isUser
|
||
|
|
? "self-end bg-primary text-primary-foreground"
|
||
|
|
: "self-start bg-muted",
|
||
|
|
)}
|
||
|
|
>
|
||
|
|
{isUser ? content : <ReactMarkdown>{content}</ReactMarkdown>}
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|