mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-04-21 05:29:57 +08:00
### What problem does this PR solve? Fix: Files being parsed are not allowed to be deleted in batches #7065 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
9c2dd70839
commit
de5727f90a
@ -379,6 +379,8 @@ This auto-tagging feature enhances retrieval by adding another layer of domain-s
|
|||||||
community: 'Community reports generation',
|
community: 'Community reports generation',
|
||||||
communityTip:
|
communityTip:
|
||||||
'In a knowledge graph, a community is a cluster of entities linked by relationships. You can have the LLM generate an abstract for each community, known as a community report. See here for more information: https://www.microsoft.com/en-us/research/blog/graphrag-improving-global-search-via-dynamic-community-selection/',
|
'In a knowledge graph, a community is a cluster of entities linked by relationships. You can have the LLM generate an abstract for each community, known as a community report. See here for more information: https://www.microsoft.com/en-us/research/blog/graphrag-improving-global-search-via-dynamic-community-selection/',
|
||||||
|
theDocumentBeingParsedCannotBeDeleted:
|
||||||
|
'The document being parsed cannot be deleted',
|
||||||
},
|
},
|
||||||
chunk: {
|
chunk: {
|
||||||
chunk: 'Chunk',
|
chunk: 'Chunk',
|
||||||
|
@ -196,6 +196,7 @@ export default {
|
|||||||
'該文件與知識圖譜相關聯。刪除後,相關節點和關係資訊將被刪除,但圖不會立即更新。更新圖動作是在解析承載知識圖譜提取任務的新文件的過程中執行的。 ',
|
'該文件與知識圖譜相關聯。刪除後,相關節點和關係資訊將被刪除,但圖不會立即更新。更新圖動作是在解析承載知識圖譜提取任務的新文件的過程中執行的。 ',
|
||||||
plainText: 'Naive',
|
plainText: 'Naive',
|
||||||
reRankModelWaring: '重排序模型非常耗時。',
|
reRankModelWaring: '重排序模型非常耗時。',
|
||||||
|
theDocumentBeingParsedCannotBeDeleted: '正在解析的文檔不能被刪除',
|
||||||
},
|
},
|
||||||
knowledgeConfiguration: {
|
knowledgeConfiguration: {
|
||||||
titleDescription: '在這裡更新您的知識庫詳細信息,尤其是切片方法。',
|
titleDescription: '在這裡更新您的知識庫詳細信息,尤其是切片方法。',
|
||||||
|
@ -196,6 +196,7 @@ export default {
|
|||||||
'该文档与知识图谱相关联。删除后,相关节点和关系信息将被删除,但图不会立即更新。更新图动作是在解析承载知识图谱提取任务的新文档的过程中执行的。',
|
'该文档与知识图谱相关联。删除后,相关节点和关系信息将被删除,但图不会立即更新。更新图动作是在解析承载知识图谱提取任务的新文档的过程中执行的。',
|
||||||
plainText: 'Naive',
|
plainText: 'Naive',
|
||||||
reRankModelWaring: '重排序模型非常耗时。',
|
reRankModelWaring: '重排序模型非常耗时。',
|
||||||
|
theDocumentBeingParsedCannotBeDeleted: '正在解析的文档不能被删除',
|
||||||
},
|
},
|
||||||
knowledgeConfiguration: {
|
knowledgeConfiguration: {
|
||||||
titleDescription: '在这里更新您的知识库详细信息,尤其是切片方法。',
|
titleDescription: '在这里更新您的知识库详细信息,尤其是切片方法。',
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
useRunNextDocument,
|
useRunNextDocument,
|
||||||
useSetNextDocumentStatus,
|
useSetNextDocumentStatus,
|
||||||
} from '@/hooks/document-hooks';
|
} from '@/hooks/document-hooks';
|
||||||
|
import { IDocumentInfo } from '@/interfaces/database/document';
|
||||||
import {
|
import {
|
||||||
DownOutlined,
|
DownOutlined,
|
||||||
FileOutlined,
|
FileOutlined,
|
||||||
@ -18,6 +19,8 @@ import {
|
|||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { Button, Dropdown, Flex, Input, MenuProps, Space } from 'antd';
|
import { Button, Dropdown, Flex, Input, MenuProps, Space } from 'antd';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
|
import { toast } from 'sonner';
|
||||||
|
import { RunningStatus } from './constant';
|
||||||
|
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
@ -28,6 +31,7 @@ interface IProps {
|
|||||||
showDocumentUploadModal(): void;
|
showDocumentUploadModal(): void;
|
||||||
searchString: string;
|
searchString: string;
|
||||||
handleInputChange: React.ChangeEventHandler<HTMLInputElement>;
|
handleInputChange: React.ChangeEventHandler<HTMLInputElement>;
|
||||||
|
documents: IDocumentInfo[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const DocumentToolbar = ({
|
const DocumentToolbar = ({
|
||||||
@ -36,6 +40,7 @@ const DocumentToolbar = ({
|
|||||||
showCreateModal,
|
showCreateModal,
|
||||||
showDocumentUploadModal,
|
showDocumentUploadModal,
|
||||||
handleInputChange,
|
handleInputChange,
|
||||||
|
documents,
|
||||||
}: IProps) => {
|
}: IProps) => {
|
||||||
const { t } = useTranslate('knowledgeDetails');
|
const { t } = useTranslate('knowledgeDetails');
|
||||||
const { removeDocument } = useRemoveNextDocument();
|
const { removeDocument } = useRemoveNextDocument();
|
||||||
@ -76,18 +81,29 @@ const DocumentToolbar = ({
|
|||||||
}, [showDocumentUploadModal, showCreateModal, t]);
|
}, [showDocumentUploadModal, showCreateModal, t]);
|
||||||
|
|
||||||
const handleDelete = useCallback(() => {
|
const handleDelete = useCallback(() => {
|
||||||
|
const deletedKeys = selectedRowKeys.filter(
|
||||||
|
(x) =>
|
||||||
|
!documents
|
||||||
|
.filter((y) => y.run === RunningStatus.RUNNING)
|
||||||
|
.some((y) => y.id === x),
|
||||||
|
);
|
||||||
|
if (deletedKeys.length === 0) {
|
||||||
|
toast.error(t('theDocumentBeingParsedCannotBeDeleted'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
showDeleteConfirm({
|
showDeleteConfirm({
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
removeDocument(selectedRowKeys);
|
removeDocument(deletedKeys);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, [removeDocument, showDeleteConfirm, selectedRowKeys]);
|
}, [selectedRowKeys, showDeleteConfirm, documents, t, removeDocument]);
|
||||||
|
|
||||||
const runDocument = useCallback(
|
const runDocument = useCallback(
|
||||||
(run: number) => {
|
(run: number) => {
|
||||||
runDocumentByIds({
|
runDocumentByIds({
|
||||||
documentIds: selectedRowKeys,
|
documentIds: selectedRowKeys,
|
||||||
run,
|
run,
|
||||||
|
shouldDelete: false,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[runDocumentByIds, selectedRowKeys],
|
[runDocumentByIds, selectedRowKeys],
|
||||||
|
@ -9,8 +9,10 @@ import {
|
|||||||
useUploadNextDocument,
|
useUploadNextDocument,
|
||||||
} from '@/hooks/document-hooks';
|
} from '@/hooks/document-hooks';
|
||||||
import { useGetKnowledgeSearchParams } from '@/hooks/route-hook';
|
import { useGetKnowledgeSearchParams } from '@/hooks/route-hook';
|
||||||
|
import { IDocumentInfo } from '@/interfaces/database/document';
|
||||||
import { IChangeParserConfigRequestBody } from '@/interfaces/request/document';
|
import { IChangeParserConfigRequestBody } from '@/interfaces/request/document';
|
||||||
import { UploadFile } from 'antd';
|
import { UploadFile } from 'antd';
|
||||||
|
import { TableRowSelection } from 'antd/es/table/interface';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { useNavigate } from 'umi';
|
import { useNavigate } from 'umi';
|
||||||
import { KnowledgeRouteKey } from './constant';
|
import { KnowledgeRouteKey } from './constant';
|
||||||
@ -126,7 +128,7 @@ export const useChangeDocumentParser = (documentId: string) => {
|
|||||||
export const useGetRowSelection = () => {
|
export const useGetRowSelection = () => {
|
||||||
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
||||||
|
|
||||||
const rowSelection = {
|
const rowSelection: TableRowSelection<IDocumentInfo> = {
|
||||||
selectedRowKeys,
|
selectedRowKeys,
|
||||||
onChange: (newSelectedRowKeys: React.Key[]) => {
|
onChange: (newSelectedRowKeys: React.Key[]) => {
|
||||||
setSelectedRowKeys(newSelectedRowKeys);
|
setSelectedRowKeys(newSelectedRowKeys);
|
||||||
|
@ -195,6 +195,7 @@ const KnowledgeFile = () => {
|
|||||||
showDocumentUploadModal={showDocumentUploadModal}
|
showDocumentUploadModal={showDocumentUploadModal}
|
||||||
searchString={searchString}
|
searchString={searchString}
|
||||||
handleInputChange={handleInputChange}
|
handleInputChange={handleInputChange}
|
||||||
|
documents={documents}
|
||||||
></DocumentToolbar>
|
></DocumentToolbar>
|
||||||
<Table
|
<Table
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user