fix: delete chunk by @tanstack/react-query #1306 (#1749)

### What problem does this PR solve?
fix: delete chunk by @tanstack/react-query #1306

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2024-07-30 16:55:00 +08:00
committed by GitHub
parent 74ebc497c1
commit ceb0419fe5
9 changed files with 239 additions and 341 deletions

View File

@ -48,37 +48,6 @@ export const useDeleteDocumentById = (): {
};
};
export const useDeleteChunkByIds = (): {
removeChunk: (chunkIds: string[], documentId: string) => Promise<number>;
} => {
const dispatch = useDispatch();
const showDeleteConfirm = useShowDeleteConfirm();
const removeChunk = useCallback(
(chunkIds: string[], documentId: string) => () => {
return dispatch({
type: 'chunkModel/rm_chunk',
payload: {
chunk_ids: chunkIds,
doc_id: documentId,
},
});
},
[dispatch],
);
const onRemoveChunk = useCallback(
(chunkIds: string[], documentId: string): Promise<number> => {
return showDeleteConfirm({ onOk: removeChunk(chunkIds, documentId) });
},
[removeChunk, showDeleteConfirm],
);
return {
removeChunk: onRemoveChunk,
};
};
export const useFetchKnowledgeBaseConfiguration = () => {
const knowledgeBaseId = useKnowledgeBaseId();