// Floating AI assistant chatbot — uses window.claude.complete const Chatbot = () => { const [open, setOpen] = useState(false); const [busy, setBusy] = useState(false); const [input, setInput] = useState(''); const [msgs, setMsgs] = useState([ { role: 'assistant', text: "Hi — I'm Webever's AI assistant. Ask me anything about AIDD, our solutions, or how we'd approach your workflow." }, ]); const scrollRef = useRef(null); useEffect(() => { if (scrollRef.current) scrollRef.current.scrollTop = scrollRef.current.scrollHeight; }, [msgs, busy]); const send = async (text) => { const q = (text ?? input).trim(); if (!q || busy) return; setInput(''); const next = [...msgs, { role: 'user', text: q }]; setMsgs(next); setBusy(true); try { const sys = `You are Webever's AI assistant on its marketing website. Webever is an AI engineering & solutions firm that builds outcome-driven systems using AI-Driven Development (AIDD). Solutions include AI chatbots, startup management systems, smart document processing, workflow automation, HRMS, and AI-enabled ERP — across 9 industries. Reply in 2-3 short sentences, friendly and concrete. Always end by inviting the user to book a demo if relevant.`; const messages = [ { role: 'user', content: sys + '\n\nUser question: ' + q }, ]; const reply = await window.claude.complete({ messages }); setMsgs(m => [...m, { role: 'assistant', text: reply }]); } catch (e) { setMsgs(m => [...m, { role: 'assistant', text: "I couldn't reach the model just now — but you can book a demo any time and a Webever engineer will get back to you." }]); } finally { setBusy(false); } }; const suggestions = [ 'What is AIDD?', 'Pricing model?', 'How fast can we ship?', ]; return ( <> {/* Bubble */} {/* Panel */} {open && (
{/* Header */}
Webever Assistant
online
{/* Messages */}
{msgs.map((m, i) => (
{m.text}
))} {busy && (
)}
{/* Suggestions */} {msgs.length <= 1 && (
{suggestions.map(s => ( ))}
)} {/* Input */}
{e.preventDefault(); send();}} className="border-t border-token p-3 flex items-center gap-2"> setInput(e.target.value)} placeholder="Ask about AIDD, solutions, pricing..." className="flex-1 bg-transparent text-[13.5px] px-2 py-1.5 outline-none" />
)} ); }; window.Chatbot = Chatbot;