File size: 1,987 Bytes
7b71fb2 f305776 7b71fb2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
import showDeleteConfirm from '@/components/deleting-confirm';
import { IKnowledgeFile } from '@/interfaces/database/knowledge';
import { DeleteOutlined, EditOutlined, ToolOutlined } from '@ant-design/icons';
import { Button, Dropdown, MenuProps, Space, Tooltip } from 'antd';
import { useDispatch } from 'umi';
interface IProps {
knowledgeBaseId: string;
record: IKnowledgeFile;
setDocumentAndParserId: () => void;
}
const ParsingActionCell = ({
knowledgeBaseId,
record,
setDocumentAndParserId,
}: IProps) => {
const dispatch = useDispatch();
const documentId = record.id;
const removeDocument = () => {
dispatch({
type: 'kFModel/document_rm',
payload: {
doc_id: documentId,
kb_id: knowledgeBaseId,
},
});
};
const onRmDocument = () => {
showDeleteConfirm({ onOk: removeDocument });
};
const setCurrentRecord = () => {
dispatch({
type: 'kFModel/setCurrentRecord',
payload: record,
});
};
const showSegmentSetModal = () => {
dispatch({
type: 'kFModel/updateState',
payload: {
isShowSegmentSetModal: true,
},
});
};
const showRenameModal = () => {
setCurrentRecord();
dispatch({
type: 'kFModel/setIsShowRenameModal',
payload: true,
});
};
const onRename = () => {};
const chunkItems: MenuProps['items'] = [
{
key: '1',
label: (
<div>
<Button type="link" onClick={showSegmentSetModal}>
分段设置
</Button>
</div>
),
},
];
return (
<Space size={'middle'}>
<Dropdown menu={{ items: chunkItems }} trigger={['click']}>
<ToolOutlined size={20} onClick={setDocumentAndParserId} />
</Dropdown>
<Tooltip title="Rename">
<EditOutlined size={20} onClick={showRenameModal} />
</Tooltip>
<DeleteOutlined size={20} onClick={onRmDocument} />
</Space>
);
};
export default ParsingActionCell;
|