mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-06 07:34:04 +08:00
Feat: Delete dataset level graph. (#17474)
### Summary Feat: Delete dataset level graph.
This commit is contained in:
@@ -30,6 +30,7 @@ import {
|
||||
import i18n from '@/locales/config';
|
||||
import kbService, {
|
||||
clearWiki,
|
||||
deleteArtifactsStructure,
|
||||
deleteKnowledgeGraph,
|
||||
getArtifactsAlteration,
|
||||
getArtifactGraph,
|
||||
@@ -95,6 +96,7 @@ export const enum KnowledgeApiAction {
|
||||
RemoveKnowledgeGraph = 'removeKnowledgeGraph',
|
||||
ClearWiki = 'clearWiki',
|
||||
FetchDatasetStructure = 'fetchDatasetStructure',
|
||||
DeleteDatasetStructure = 'deleteDatasetStructure',
|
||||
FetchArtifactAlteration = 'fetchArtifactAlteration',
|
||||
RunArtifactIndex = 'runArtifactIndex',
|
||||
}
|
||||
@@ -833,6 +835,31 @@ export function useFetchDatasetStructureGraph(kind: string, keywords?: string) {
|
||||
return { data, loading };
|
||||
}
|
||||
|
||||
export const useDeleteDatasetStructure = () => {
|
||||
const knowledgeBaseId = useKnowledgeBaseId();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const {
|
||||
data,
|
||||
isPending: loading,
|
||||
mutateAsync,
|
||||
} = useMutation({
|
||||
mutationKey: [KnowledgeApiAction.DeleteDatasetStructure],
|
||||
mutationFn: async (kind: string) => {
|
||||
const { data } = await deleteArtifactsStructure(knowledgeBaseId, kind);
|
||||
if (data?.code === 0) {
|
||||
message.success(i18n.t('message.deleted'));
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: DatasetStructureKeys.all(knowledgeBaseId),
|
||||
});
|
||||
}
|
||||
return data?.code;
|
||||
},
|
||||
});
|
||||
|
||||
return { data, loading, deleteDatasetStructure: mutateAsync };
|
||||
};
|
||||
|
||||
export function useFetchKnowledgeMetadata(kbIds: string[] = []) {
|
||||
const { data, isFetching: loading } = useQuery<
|
||||
Record<string, Record<string, string[]>>
|
||||
|
||||
Reference in New Issue
Block a user