mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-19 12:06:42 +08:00
feat: add batch operations for document list (#302)
### What problem does this PR solve? document list needs to be batch operated Issue link: #301 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -155,23 +155,26 @@ export const useSetDocumentParser = () => {
|
||||
return setDocumentParser;
|
||||
};
|
||||
|
||||
export const useRemoveDocument = (documentId: string) => {
|
||||
export const useRemoveDocument = () => {
|
||||
const dispatch = useDispatch();
|
||||
const { knowledgeId } = useGetKnowledgeSearchParams();
|
||||
|
||||
const removeDocument = useCallback(() => {
|
||||
try {
|
||||
return dispatch<any>({
|
||||
type: 'kFModel/document_rm',
|
||||
payload: {
|
||||
doc_id: documentId,
|
||||
kb_id: knowledgeId,
|
||||
},
|
||||
});
|
||||
} catch (errorInfo) {
|
||||
console.log('Failed:', errorInfo);
|
||||
}
|
||||
}, [dispatch, knowledgeId, documentId]);
|
||||
const removeDocument = useCallback(
|
||||
(documentId: string) => {
|
||||
try {
|
||||
return dispatch<any>({
|
||||
type: 'kFModel/document_rm',
|
||||
payload: {
|
||||
doc_id: documentId,
|
||||
kb_id: knowledgeId,
|
||||
},
|
||||
});
|
||||
} catch (errorInfo) {
|
||||
console.log('Failed:', errorInfo);
|
||||
}
|
||||
},
|
||||
[dispatch, knowledgeId],
|
||||
);
|
||||
|
||||
return removeDocument;
|
||||
};
|
||||
@ -204,11 +207,11 @@ export const useRunDocument = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const runDocumentByIds = useCallback(
|
||||
(ids: string[]) => {
|
||||
(payload: any) => {
|
||||
try {
|
||||
return dispatch<any>({
|
||||
type: 'kFModel/document_run',
|
||||
payload: { doc_ids: ids, run: 1 },
|
||||
payload,
|
||||
});
|
||||
} catch (errorInfo) {
|
||||
console.log('Failed:', errorInfo);
|
||||
|
||||
Reference in New Issue
Block a user