import { isMobile } from '../../utils/utils'; import { DislikeOutlined, LikeOutlined, DownloadOutlined, RedoOutlined, FileJpgOutlined, } from '@ant-design/icons'; import { Button } from 'antd'; import { CLS_PREFIX } from '../../common/constants'; import { useContext, useState } from 'react'; import classNames from 'classnames'; import { updateQAFeedback } from '../../service'; import { useMethodRegister } from '../../hooks'; import { ChartItemContext } from '../ChatItem'; type Props = { queryId: number; scoreValue?: number; isLastMessage?: boolean; isParserError?: boolean; isSimpleMode?: boolean; onExportData?: () => void; onReExecute?: (queryId: number) => void; }; const Tools: React.FC = ({ queryId, scoreValue, isLastMessage, isParserError = false, isSimpleMode = false, onExportData, onReExecute, }) => { const [score, setScore] = useState(scoreValue || 0); const [exportLoading, setExportLoading] = useState(false); const prefixCls = `${CLS_PREFIX}-tools`; const like = () => { setScore(5); updateQAFeedback(queryId, 5); }; const dislike = () => { setScore(1); updateQAFeedback(queryId, 1); }; const likeClass = classNames(`${prefixCls}-like`, { [`${prefixCls}-feedback-active`]: score === 5, }); const dislikeClass = classNames(`${prefixCls}-dislike`, { [`${prefixCls}-feedback-active`]: score === 1, }); const { call } = useContext(ChartItemContext); return (
{!isMobile && (
{/*
这个回答正确吗?
*/}
{!isParserError && ( <> {!isSimpleMode && ( )} {isLastMessage && ( )} )}
{ e.stopPropagation(); dislike(); }} />
)}
); }; export default Tools;