Feat: Rename a dataset #3221 (#7162)

### What problem does this PR solve?

Feat: Rename a dataset #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-04-22 10:09:41 +08:00
committed by GitHub
parent ad220a0a3c
commit e7f83b13ca
9 changed files with 151 additions and 20 deletions

View File

@ -180,7 +180,7 @@ export const useDeleteKnowledge = () => {
//#region knowledge configuration
export const useUpdateKnowledge = () => {
export const useUpdateKnowledge = (shouldFetchList = false) => {
const knowledgeBaseId = useKnowledgeBaseId();
const queryClient = useQueryClient();
const {
@ -191,12 +191,18 @@ export const useUpdateKnowledge = () => {
mutationKey: ['saveKnowledge'],
mutationFn: async (params: Record<string, any>) => {
const { data = {} } = await kbService.updateKb({
kb_id: knowledgeBaseId,
kb_id: params?.kb_id ? params?.kb_id : knowledgeBaseId,
...params,
});
if (data.code === 0) {
message.success(i18n.t(`message.updated`));
queryClient.invalidateQueries({ queryKey: ['fetchKnowledgeDetail'] });
if (shouldFetchList) {
queryClient.invalidateQueries({
queryKey: ['infiniteFetchKnowledgeList'],
});
} else {
queryClient.invalidateQueries({ queryKey: ['fetchKnowledgeDetail'] });
}
}
return data;
},