import React, { useState, useEffect } from 'react'; import Card from "components/ui/card"; import { ArrowRightIcon, CheckBadgeIcon, InboxIcon, InformationCircleIcon } from "@heroicons/react/24/outline"; import { AIBotIcon, BotIcon } from "app/dashboard/components/icons/icon-svg"; import { ArrowUpCircleIcon } from "@heroicons/react/24/solid"; import { Dialog, DialogContent, DialogHeader, DialogTitle, } from "components/ui/dialog"; import { MessagesSquare, Lock } from "lucide-react"; import { AnimatedLogo } from "components/animated-logo"; import { cn } from 'lib/utils'; import useCommonDispatch from 'hooks/useCommonDispatch'; import TooltipText from "components/ui/tooltip-text"; import Mode from 'app/page-optimizer/components/Mode'; import ProTooltip from 'components/ProTooltip'; const AIBot = ({ className }: { className: string }) => { const [open, setOpen] = useState(false); const { licenseConnected } = useCommonDispatch() const [conversations, setConversations] = useState(() => { const saved = localStorage.getItem('chat-conversations'); return saved ? JSON.parse(saved) : []; }); const handleConversationSelect = (conv: any) => { // Add conversation ID to URL hash window.location.hash = `#/rapidload-ai?conv=${conv.id}`; setOpen(false); }; const questions = [ 'CSS Delivery?', 'JS Delivery?', 'Image Delivery?', 'CDN Delivery?', ]; return (
Chat History
{conversations.length === 0 ? (
No chat history yet
) : ( conversations.map((conv: any) => (
handleConversationSelect(conv)} className="flex items-center gap-2 p-3 border rounded-lg hover:bg-gray-100 cursor-pointer dark:bg-brand-800/40 dark:text-brand-300 dark:hover:bg-brand-800/50" > {conv.title}
)) )}
{/* */}

Chat with Rapidload AI

Understands your page speed and website issues to help you improve speed

{/*

Suggested Questions

{questions.map((question, index) => ( ))}
*/}
{!licenseConnected ? ( (window.location.hash = '#/rapidload-ai')} placeholder="Ask about anything..." className="w-full p-2 border cursor-pointer border-brand-200 dark:bg-brand-600/40 dark:text-brand-300 dark:border-brand-700 rounded-full focus:outline-none focus:border-black bg-brand-100 pr-10 pl-4" />
) : ( <> (window.location.hash = '#/rapidload-ai')} placeholder="Ask about anything..." className="w-full p-2 border border-brand-200 dark:bg-brand-600/40 dark:text-brand-300 dark:border-brand-700 rounded-full focus:outline-none focus:border-black bg-brand-100 pr-10 pl-4" />
)}
); } export default AIBot;