import { useEffect, useRef } from "react"; import Message from "./Message.jsx"; export default function MessageList({ messages, showMeta, onPrompt, onFeedback, onRegenerate, rated }) { const wrapRef = useRef(null); // Auto-scroll to the bottom on new messages useEffect(() => { if (!wrapRef.current) return; wrapRef.current.scrollTop = wrapRef.current.scrollHeight; }, [messages]); const lastAsstIdx = (() => { for (let i = messages.length - 1; i >= 0; i--) { if (messages[i].role === "assistant" && !messages[i]._placeholder) return i; } return -1; })(); return (
{messages.length === 0 ? (
Ask APE about a money decision
Start with one of these, or write your own question.
{PROMPTS.map((prompt) => ( ))}
) : (
{messages.map((m, i) => ( ))}
)}
); } const PROMPTS = [ "Compare Roth IRA vs Traditional IRA", "Make a debt payoff plan in numbered steps", "Explain expense ratios with a simple example", "Help me decide between saving and investing", ]; function PromptArrow() { return ( ); }