diff --git a/projects/app/src/pages/dataset/list/component/List.tsx b/projects/app/src/pages/dataset/list/component/List.tsx index 45eafb863b8f..2c1f85818a8f 100644 --- a/projects/app/src/pages/dataset/list/component/List.tsx +++ b/projects/app/src/pages/dataset/list/component/List.tsx @@ -1,5 +1,5 @@ import React, { useMemo, useRef, useState } from 'react'; -import { resumeInheritPer } from '@/web/core/dataset/api'; +import { changeOwner, resumeInheritPer } from '@/web/core/dataset/api'; import { Box, Flex, Grid, HStack } from '@chakra-ui/react'; import { DatasetTypeEnum, DatasetTypeMap } from '@fastgpt/global/core/dataset/constants'; import MyMenu from '@fastgpt/web/components/common/MyMenu'; @@ -422,6 +422,12 @@ function List() { {!!editPerDataset && ( + changeOwner({ + datasetId: editPerDataset._id, + ownerId: tmbId + }).then(() => loadMyDatasets()) + } hasParent={!!parentId} refetchResource={loadMyDatasets} isInheritPermission={editPerDataset.inheritPermission} diff --git a/projects/app/src/web/core/dataset/api.ts b/projects/app/src/web/core/dataset/api.ts index d5cc2229130b..41ff95ae5cdb 100644 --- a/projects/app/src/web/core/dataset/api.ts +++ b/projects/app/src/web/core/dataset/api.ts @@ -67,6 +67,7 @@ import type { listExistIdResponse } from '@/pages/api/core/dataset/apiDataset/listExistId'; import { FeishuServer, YuqueServer } from '@fastgpt/global/core/dataset/apiDataset'; +import { RequireOnlyOne } from '@fastgpt/global/common/type/utils'; /* ======================== dataset ======================= */ export const getDatasets = (data: GetDatasetListBody) => @@ -100,6 +101,9 @@ export const postCreateDatasetFolder = (data: DatasetFolderCreateBody) => export const resumeInheritPer = (datasetId: string) => GET(`/core/dataset/resumeInheritPermission`, { datasetId }); +export const changeOwner = (data: { ownerId: string; datasetId: string }) => + POST(`/proApi/core/dataset/changeOwner`, data); + /* =========== search test ============ */ export const postSearchText = (data: SearchTestProps) => POST(`/core/dataset/searchTest`, data);