Skip to content

Commit

Permalink
perf: dataset ui
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Jun 24, 2024
1 parent eaf24ae commit b94c72e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
16 changes: 3 additions & 13 deletions projects/app/src/pages/api/core/dataset/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ import { DatasetDefaultPermissionVal } from '@fastgpt/global/support/permission/
import { ParentIdType } from '@fastgpt/global/common/parentFolder/type';
import { parseParentIdInMongo } from '@fastgpt/global/common/parentFolder/utils';

export type GetDatasetListBody = { parentId: ParentIdType; type?: DatasetTypeEnum };

async function handler(req: NextApiRequest) {
const { parentId, type } = req.body as { parentId: ParentIdType; type?: DatasetTypeEnum };
const { parentId, type } = req.body as GetDatasetListBody;
// 凭证校验
const {
teamId,
Expand All @@ -28,18 +30,6 @@ async function handler(req: NextApiRequest) {
authApiKey: true,
per: ReadPermissionVal
});
console.log(
'parentId',
parentId,
'type',
type,
'teamId',
teamId,
'tmbId',
tmbId,
'tmbPer',
tmbPer
);

const [myDatasets, rpList] = await Promise.all([
MongoDataset.find({
Expand Down
6 changes: 3 additions & 3 deletions projects/app/src/pages/dataset/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ const Dataset = () => {
return (
<PageContainer
isLoading={myDatasets.length === 0 && isFetchingDatasets}
insertProps={{ px: [5, '48px'] }}
insertProps={{ px: folderDetail ? [4, 6] : [5, '10'] }}
>
<Flex pt={[8, 10]} pr={folderDetail ? [4, 6] : [4, 10]}>
<Flex pt={[4, 6]}>
<Flex flexGrow={1} flexDirection="column">
<Flex alignItems={'center'} justifyContent={'space-between'}>
<Flex alignItems={'flex-start'} justifyContent={'space-between'}>
<ParentPaths
paths={paths}
FirstPathDom={
Expand Down
3 changes: 2 additions & 1 deletion projects/app/src/web/core/dataset/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ import type {
PreviewChunksResponse
} from '@/pages/api/core/dataset/file/getPreviewChunks';
import type { readCollectionSourceResponse } from '@/pages/api/core/dataset/collection/read';
import type { GetDatasetListBody } from '@/pages/api/core/dataset/list';

/* ======================== dataset ======================= */
export const getDatasets = (data: { parentId?: ParentIdType; type?: DatasetTypeEnum }) =>
export const getDatasets = (data: GetDatasetListBody) =>
POST<DatasetListItemType[]>(`/core/dataset/list`, data);

/**
Expand Down

0 comments on commit b94c72e

Please sign in to comment.