import { useEffect, useRef, useState } from "react"; import { clsx } from "clsx"; import { IconButton } from "./icon-button"; export const AssistantText = ({ name,message }: { name:string, message: string }) => { const scrollRef = useRef(null); const [unlimited, setUnlimited] = useState(false) // Replace all of the emotion tag in message with "" message = message.replace(/\[(.*?)\]/g, ""); useEffect(() => { scrollRef.current?.scrollIntoView({ behavior: "smooth", block: "center", }); }); return (
{name.toUpperCase()} setUnlimited(!unlimited)} />
{message.replace(/\[([a-zA-Z]*?)\]/g, "")}
); };