'use client'; import { useEffect, useRef } from 'react'; import { useStore } from '@/lib/store'; import { renderMarkdown } from '@/lib/markdown'; export default function MessageList() { const { messages, isLoading } = useStore(); const bottomRef = useRef(null); useEffect(() => { bottomRef.current?.scrollIntoView({ behavior: 'smooth' }); }, [messages, isLoading]); if (!messages.length && !isLoading) { return (

What are you working on?

Ask about your documents, projects, research, or anything else. Your entire corpus is available.

); } return (
{messages.map((m, i) => (
{m.role === 'user' ? 'you' : 'aaron ai'}
{m.role === 'assistant' ? (
) : ( {m.content} )}
{m.sources && m.sources.length > 0 && (
Sources: {[...new Set(m.sources)].join(', ')}
)}
))} {isLoading && (
aaron ai
Thinking...
)}
); }