import React, { ForwardedRef, useEffect, useRef } from 'react'; type Message = { role: string content: string } interface ConversationProps { messages: Message[]; onResendClick: () => void; onEditClick: () => void; onCopyClick: () => void; isClicked: boolean } const ConversationFrontend = React.forwardRef( ({ messages, onResendClick, onEditClick, onCopyClick, isClicked}, ref: ForwardedRef) => { const endOfMessagesRef = useRef(null); return (
{messages.map((message, index) => { let isUserMessage if (message.role == "user") { isUserMessage = message } if (index >= 1){ return (

{message.content}

); } })} {/* Dummy div to mark the end of the conversation for auto-scrolling */}

Copied!

); } ); export default ConversationFrontend;