import { TrashIcon } from "@heroicons/react/24/outline"; import Link from "next/link"; import React from "react"; import { iconUrl } from "~/utils/icon"; type Message = { isBot: boolean; message: string; }; type History = { bot_response: string; human_message: string; }; type Props = { title: string | null; id: string; created_at: Date | null; icon: string | null; url: string | null; }; export const CahtBox = (props: Props) => { const [messages, setMessages] = React.useState([ { isBot: true, message: "Hi, I'm PageAssist Bot. How can I help you?", }, ]); const [history, setHistory] = React.useState([]); const divRef = React.useRef(null); React.useEffect(() => { //@ts-ignore divRef.current.scrollIntoView({ behavior: "smooth" }); }); return (
{/* header */}

{props?.title && props?.title?.length > 100 ? props?.title?.slice(0, 100) + "..." : props?.title}

{props.url && new URL(props.url).hostname}

{/* */}
{messages.map((message, index) => { return (

{/* {message.message} */} {message.message}

); })}
{ // setMessages([...messages, values]) // form.reset() // await sendToBotAsync(values.message) // })} >
); };