import React from "react" import { useMessageOption } from "~/hooks/useMessageOption" import { PlaygroundEmpty } from "./PlaygroundEmpty" import { PlaygroundMessage } from "~/components/Common/Playground/Message" import { MessageSourcePopup } from "@/components/Common/Playground/MessageSourcePopup" export const PlaygroundChat = () => { const { messages, streaming, regenerateLastMessage, isSearchingInternet, editMessage, ttsEnabled, setCurrentMessageId, } = useMessageOption() const [isSourceOpen, setIsSourceOpen] = React.useState(false) const [source, setSource] = React.useState(null) return ( <>
{messages.length === 0 && (
)} {messages.map((message, index) => ( { editMessage(index, value, !message.isBot, isSend) }} onSourceClick={(data) => { setSource(data) setIsSourceOpen(true) }} isTTSEnabled={ttsEnabled} generationInfo={message?.generationInfo} isStreaming={streaming} reasoningTimeTaken={message?.reasoning_time_taken} setCurrentMessageId={setCurrentMessageId} iodSearch={message.iodSearch} /> ))}
{messages.length !== 0 &&
} ) }