| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 | 
							- import CopyToClipboard from '@/components/copy-to-clipboard';
 - import { useSetModalState } from '@/hooks/common-hooks';
 - import { IRemoveMessageById } from '@/hooks/logic-hooks';
 - import {
 -   DeleteOutlined,
 -   DislikeOutlined,
 -   LikeOutlined,
 -   SoundOutlined,
 -   SyncOutlined,
 - } from '@ant-design/icons';
 - import { Radio, Tooltip } from 'antd';
 - import { useCallback } from 'react';
 - import { useTranslation } from 'react-i18next';
 - import SvgIcon from '../svg-icon';
 - import FeedbackModal from './feedback-modal';
 - import { useRemoveMessage, useSendFeedback } from './hooks';
 - import PromptModal from './prompt-modal';
 - 
 - interface IProps {
 -   messageId: string;
 -   content: string;
 -   prompt?: string;
 - }
 - 
 - export const AssistantGroupButton = ({
 -   messageId,
 -   content,
 -   prompt,
 - }: IProps) => {
 -   const { visible, hideModal, showModal, onFeedbackOk, loading } =
 -     useSendFeedback(messageId);
 -   const {
 -     visible: promptVisible,
 -     hideModal: hidePromptModal,
 -     showModal: showPromptModal,
 -   } = useSetModalState();
 -   const { t } = useTranslation();
 - 
 -   const handleLike = useCallback(() => {
 -     onFeedbackOk({ thumbup: true });
 -   }, [onFeedbackOk]);
 - 
 -   return (
 -     <>
 -       <Radio.Group size="small">
 -         <Radio.Button value="a">
 -           <CopyToClipboard text={content}></CopyToClipboard>
 -         </Radio.Button>
 -         <Radio.Button value="b">
 -           <Tooltip title={t('chat.read')}>
 -             <SoundOutlined />
 -           </Tooltip>
 -         </Radio.Button>
 -         <Radio.Button value="c" onClick={handleLike}>
 -           <LikeOutlined />
 -         </Radio.Button>
 -         <Radio.Button value="d" onClick={showModal}>
 -           <DislikeOutlined />
 -         </Radio.Button>
 -         {prompt && (
 -           <Radio.Button value="e" onClick={showPromptModal}>
 -             <SvgIcon name={`prompt`} width={16}></SvgIcon>
 -           </Radio.Button>
 -         )}
 -       </Radio.Group>
 -       {visible && (
 -         <FeedbackModal
 -           visible={visible}
 -           hideModal={hideModal}
 -           onOk={onFeedbackOk}
 -           loading={loading}
 -         ></FeedbackModal>
 -       )}
 -       {promptVisible && (
 -         <PromptModal
 -           visible={promptVisible}
 -           hideModal={hidePromptModal}
 -           prompt={prompt}
 -         ></PromptModal>
 -       )}
 -     </>
 -   );
 - };
 - 
 - interface UserGroupButtonProps extends IRemoveMessageById {
 -   messageId: string;
 -   content: string;
 -   regenerateMessage(): void;
 -   sendLoading: boolean;
 - }
 - 
 - export const UserGroupButton = ({
 -   content,
 -   messageId,
 -   sendLoading,
 -   removeMessageById,
 -   regenerateMessage,
 - }: UserGroupButtonProps) => {
 -   const { onRemoveMessage, loading } = useRemoveMessage(
 -     messageId,
 -     removeMessageById,
 -   );
 -   const { t } = useTranslation();
 - 
 -   return (
 -     <Radio.Group size="small">
 -       <Radio.Button value="a">
 -         <CopyToClipboard text={content}></CopyToClipboard>
 -       </Radio.Button>
 -       <Radio.Button
 -         value="b"
 -         onClick={regenerateMessage}
 -         disabled={sendLoading}
 -       >
 -         <Tooltip title={t('chat.regenerate')}>
 -           <SyncOutlined spin={sendLoading} />
 -         </Tooltip>
 -       </Radio.Button>
 -       <Radio.Button value="c" onClick={onRemoveMessage} disabled={loading}>
 -         <Tooltip title={t('common.delete')}>
 -           <DeleteOutlined spin={loading} />
 -         </Tooltip>
 -       </Radio.Button>
 -     </Radio.Group>
 -   );
 - };
 
 
  |