import ScrollToBottom, { useScrollToBottom, useSticky } from "react-scroll-to-bottom"; import { IconArrowDown } from "@tabler/icons-react"; import { ChatMessage } from "./ChatMessage"; import { WelcomeScreen } from "./WelcomeScreen"; import { useChatStore } from "@/stores"; import { cn } from "@/lib/utils"; import { getForkTurnIndex } from "shared/fork-turn-index"; function ScrollButton() { const scrollToBottom = useScrollToBottom(); const [sticky] = useSticky(); if (sticky) return null; return ( ); } function MessageList() { const messages = useChatStore((s) => s.messages); const isStreaming = useChatStore((s) => s.isStreaming); return ( <>
{messages.map((message, idx) => ( ))}
); } export function ChatArea() { const messageCount = useChatStore((s) => s.messages.length); if (messageCount === 0) { return (
); } return (
); }