import React, { useEffect, useRef } from 'react'; import ReactMarkdown from 'react-markdown'; export default function ChatWindow({ messages, loading }) { const windowEndRef = useRef(null); useEffect(() => { windowEndRef.current?.scrollIntoView({ behavior: 'smooth' }); }, [messages, loading]); return (
{messages.map((msg, index) => { const isUser = msg.sender === 'user'; return (
{!isUser && (
🤖
)}
{/* Wraps ReactMarkdown in a div to prevent the v9 crash */}
{msg.text}
); })} {loading && (
âš¡
Routing through LangGraph...
)}
); }