"use client"; import React, { useState, useEffect, useRef, memo } from "react"; import { MessageSquare, Send, Code2, Palette, Search, Trash2, Copy, Monitor, StopCircle, X, Zap, Ghost, Wand2, LayoutPanelLeft, Play, Orbit, Plus } from "lucide-react"; import ReactMarkdown from "react-markdown"; import remarkGfm from "remark-gfm"; import rehypeHighlight from "rehype-highlight"; import { cn } from "@/lib/utils"; import { AIAssistMessage } from "@/types"; import { Button } from "@/components/ui/button"; import { Card } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { Input } from "@/components/ui/input"; import useStore from "@/lib/store"; import { translations } from "@/lib/i18n/translations"; import modelAdapter from "@/lib/services/adapter-instance"; // --- Types --- interface PreviewData { type: string; data: string; language?: string; isStreaming?: boolean; } // --- Specialized Components --- /** * A ultra-stable iframe wrapper that avoids hydration issues * and provides a WOW visual experience. */ const BuildingArtifact = ({ type }: { type: string }) => { const [progress, setProgress] = useState(0); const steps = [ "Initializing neural links...", "Scaffolding architecture...", "Writing logic blocks...", "Injecting dynamic modules...", "Finalizing interactive layers..." ]; const [currentStep, setCurrentStep] = useState(0); useEffect(() => { const interval = setInterval(() => { setProgress(p => (p < 95 ? p + (100 - p) * 0.1 : p)); setCurrentStep(s => (s < steps.length - 1 ? s + 1 : s)); }, 2000); return () => clearInterval(interval); }, []); return (
{renderError}
Agent {currentAgent}
Switch agents, stream answers, and light up the canvas with live artifacts.
Architecture
{aiPlan.architecture}
Tech Stack
Files
{aiPlan.files?.length} modules planned
{previewData?.data}