import { ScoreItemType } from '@/components/core/dataset/QuoteItem'; import { Box, Flex } from '@chakra-ui/react'; import MyIcon from '@fastgpt/web/components/common/Icon'; import ScoreTag from './ScoreTag'; import Markdown from '@/components/Markdown'; import MyTooltip from '@fastgpt/web/components/common/MyTooltip'; import { useTranslation } from 'react-i18next'; import { useCopyData } from '@fastgpt/web/hooks/useCopyData'; const QuoteItem = ({ index, icon, sourceName, score, q, a }: { index: number; icon: string; sourceName: string; score: { primaryScore?: ScoreItemType; secondaryScore: ScoreItemType[] }; q: string; a?: string; }) => { const { t } = useTranslation(); const { copyData } = useCopyData(); const isDeleted = !q; return ( {index + 1} {sourceName} {score && !isDeleted && ( )} {!isDeleted ? ( <> {!!a && ( )} ) : ( {t('chat:chat.quote.deleted')} )} {q.length + (a?.length || 0)} { copyData(q + '\n' + a); }} > ); }; export default QuoteItem;