import { PromptIcon } from '@/assets/icon/next-icon'; import CopyToClipboard from '@/components/copy-to-clipboard'; import { Tooltip, TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip'; import { useSetModalState } from '@/hooks/common-hooks'; import { IRemoveMessageById } from '@/hooks/logic-hooks'; import { cn } from '@/lib/utils'; import { LucidePauseCircle, LucideRefreshCw, LucideThumbsDown, LucideThumbsUp, LucideTrash2, LucideVolume2, } from 'lucide-react'; import { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import FeedbackDialog from '../feedback-dialog'; import { PromptDialog } from '../prompt-dialog'; import { Button } from '../ui/button'; import { useRemoveMessage, useSendFeedback, useSpeech } from './hooks'; interface IProps { messageId: string; content: string; prompt?: string; showLikeButton: boolean; audioBinary?: string; showLoudspeaker?: boolean; } export const AssistantGroupButton = ({ messageId, content, prompt, audioBinary, showLikeButton, showLoudspeaker = true, }: IProps) => { const { visible, hideModal, showModal, onFeedbackOk, loading } = useSendFeedback(messageId); const { visible: promptVisible, hideModal: hidePromptModal, showModal: showPromptModal, } = useSetModalState(); const { t } = useTranslation(); const { handleRead, ref, isPlaying } = useSpeech(content, audioBinary); const handleLike = useCallback(() => { onFeedbackOk({ thumbup: true }); }, [onFeedbackOk]); return ( <>