import { CheckIcon, ClipboardIcon } from "@heroicons/react/24/outline" import Markdown from "../../Common/Markdown" import React from "react" import { Image } from "antd" type Props = { message: string hideCopy?: boolean botAvatar?: JSX.Element userAvatar?: JSX.Element isBot: boolean name: string images?: string[] } export const PlaygroundMessage = (props: Props) => { const [isBtnPressed, setIsBtnPressed] = React.useState(false) React.useEffect(() => { if (isBtnPressed) { setTimeout(() => { setIsBtnPressed(false) }, 4000) } }, [isBtnPressed]) return (
{props.isBot ? ( !props.botAvatar ? (
) : ( props.botAvatar ) ) : !props.userAvatar ? (
) : ( props.userAvatar )}
{props.isBot && ( {props.name} )}
{/* source if aviable */} {props.images && (
{props.images && (
{props.images .filter((image) => image.length > 0) .map((image, index) => ( Uploaded Image ))}
)}
)} {props.isBot && (
{!props.hideCopy && ( )}
)}
) }