File size: 570 Bytes
6a317c1
 
 
 
 
 
 
 
 
 
 
 
 
 
d32544a
 
a74762c
6a317c1
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import React from 'react';

export interface Message {
  role: 'user' | 'assistant';
  content: string;
}

interface MessageItemProps {
  message: Message;
}

export default function MessageItem({ message }: MessageItemProps) {
  const alignment = message.role === 'user' ? 'items-end' : 'items-start';
  return (
    <div className={`flex flex-col ${alignment} animate-fadeIn`}>
      <div className="w-full max-w-xl p-3 my-2 glass-panel rounded-lg shadow-md">
        <p className="whitespace-pre-wrap break-words">{message.content}</p>
      </div>
    </div>
  );
}