import { useEffect, useState } from "react"; import { LandingPage } from "./components/LandingPage"; import { ChatApp } from "./components/ChatApp"; import { useLLM } from "./hooks/useLLM"; import { Loader2 } from "lucide-react"; import "katex/dist/katex.min.css"; function App() { const { status, loadModel, selectedModel, setSelectedModel, loadedModelId } = useLLM(); const [hasStarted, setHasStarted] = useState(false); const [showChat, setShowChat] = useState(false); const isReady = status.state === "ready" && loadedModelId === selectedModel.id; const isLoading = hasStarted && !isReady && status.state !== "error"; const handleStart = () => { setHasStarted(true); loadModel(); }; const handleGoHome = () => { setShowChat(false); setTimeout(() => setHasStarted(false), 700); }; useEffect(() => { if (isReady && hasStarted) { setShowChat(true); } }, [isReady, hasStarted]); return (
{/* Landing page — hidden once loading starts */}
{/* Chat page — fades in when ready */}
{hasStarted && }
{/* Loading overlay — sits on top, fades from loading screen directly to chat */}
AI2

{status.state === "loading" ? (status.message ?? "Loading model…") : status.state === "error" ? "Error" : "Initializing…"}

{status.state === "error" && (

{status.error}

)}
); } export default App;