Spaces:
Running
Running
| type MessageType = "user" | "assistant"; | |
| interface ChatMessageProps { | |
| type: MessageType; | |
| content: string; | |
| } | |
| export default function ChatMessage({ type, content }: ChatMessageProps) { | |
| return ( | |
| <div | |
| className={`flex ${ | |
| type === "user" ? "justify-end" : "justify-start" | |
| } mb-4`} | |
| > | |
| <div | |
| className={`max-w-[80%] rounded-lg px-4 py-2 ${ | |
| type === "user" | |
| ? "bg-blue-500 text-white" | |
| : "bg-gray-100 dark:bg-gray-800" | |
| }`} | |
| > | |
| {content} | |
| </div> | |
| </div> | |
| ); | |
| } | |