diff --git a/frontend/src/components/chatMessage/index.tsx b/frontend/src/components/chatMessage/index.tsx index 9da940b2..77e043bd 100644 --- a/frontend/src/components/chatMessage/index.tsx +++ b/frontend/src/components/chatMessage/index.tsx @@ -1,58 +1,49 @@ import { Remark } from 'react-remark'; +import { Avatar } from 'reshaped'; type ChatMessageProps = { index: number; + userName?: string; + userPicture?: string; refresh: (_: number) => void; deleteMessage: (_: number) => void; convertToComment: (_: number) => void; }; export default function ChatMessage(props: ChatMessage & ChatMessageProps) { + const getAvatarSrc = () => { + if (props.role === 'user') { + // Use Auth0 picture if available, otherwise use initials avatar + if (props.userPicture) { + return props.userPicture; + } + const userName = props.userName || 'User'; + return `https://api.dicebear.com/9.x/initials/svg?seed=${encodeURIComponent(userName)}&backgroundColor=1e88e5`; + } else { + // AI assistant avatar + return 'https://api.dicebear.com/9.x/bottts/svg?seed=AI&backgroundColor=10b981'; + } + }; + return (