mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 20:37:48 +00:00
Feat: App folder and permission (#1726)
* app folder * feat: app foldere * fix: run app param error * perf: select app ux * perf: folder rerender * fix: ts * fix: parentId * fix: permission * perf: loading ux * perf: per select ux * perf: clb context * perf: query extension tip * fix: ts * perf: app detail per * perf: default per
This commit is contained in:
14
packages/global/common/parentFolder/type.d.ts
vendored
14
packages/global/common/parentFolder/type.d.ts
vendored
@@ -2,3 +2,17 @@ export type ParentTreePathItemType = {
|
||||
parentId: string;
|
||||
parentName: string;
|
||||
};
|
||||
export type ParentIdType = string | null | undefined;
|
||||
|
||||
export type GetResourceFolderListProps = {
|
||||
parentId: ParentIdType;
|
||||
};
|
||||
export type GetResourceFolderListItemResponse = {
|
||||
name: string;
|
||||
id: string;
|
||||
};
|
||||
|
||||
export type GetResourceListItemResponse = GetResourceFolderListItemResponse & {
|
||||
avatar: string;
|
||||
isFolder: boolean;
|
||||
};
|
||||
|
17
packages/global/common/parentFolder/utils.ts
Normal file
17
packages/global/common/parentFolder/utils.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { ParentIdType } from './type';
|
||||
|
||||
export const parseParentIdInMongo = (parentId: ParentIdType) => {
|
||||
if (parentId === undefined) return {};
|
||||
|
||||
if (parentId === null || parentId === '')
|
||||
return {
|
||||
parentId: null
|
||||
};
|
||||
|
||||
const pattern = /^[0-9a-fA-F]{24}$/;
|
||||
if (pattern.test(parentId))
|
||||
return {
|
||||
parentId
|
||||
};
|
||||
return {};
|
||||
};
|
@@ -1,10 +1,14 @@
|
||||
import { AppTTSConfigType, AppWhisperConfigType } from './type';
|
||||
|
||||
export enum AppTypeEnum {
|
||||
folder = 'folder',
|
||||
simple = 'simple',
|
||||
advanced = 'advanced'
|
||||
}
|
||||
export const AppTypeMap = {
|
||||
[AppTypeEnum.folder]: {
|
||||
label: 'folder'
|
||||
},
|
||||
[AppTypeEnum.simple]: {
|
||||
label: 'simple'
|
||||
},
|
||||
|
9
packages/global/core/app/type.d.ts
vendored
9
packages/global/core/app/type.d.ts
vendored
@@ -1,5 +1,4 @@
|
||||
import type { FlowNodeTemplateType, StoreNodeItemType } from '../workflow/type';
|
||||
|
||||
import { AppTypeEnum } from './constants';
|
||||
import { PermissionTypeEnum } from '../../support/permission/constant';
|
||||
import { VariableInputEnum } from '../workflow/constants';
|
||||
@@ -9,14 +8,17 @@ import { TeamTagSchema as TeamTagsSchemaType } from '@fastgpt/global/support/use
|
||||
import { StoreEdgeItemType } from '../workflow/type/edge';
|
||||
import { PermissionValueType } from '../../support/permission/type';
|
||||
import { AppPermission } from '../../support/permission/app/controller';
|
||||
import { ParentIdType } from '../../common/parentFolder/type';
|
||||
|
||||
export type AppSchema = {
|
||||
_id: string;
|
||||
parentId?: ParentIdType;
|
||||
teamId: string;
|
||||
tmbId: string;
|
||||
name: string;
|
||||
type: `${AppTypeEnum}`;
|
||||
type: AppTypeEnum;
|
||||
version?: 'v1' | 'v2';
|
||||
|
||||
name: string;
|
||||
avatar: string;
|
||||
intro: string;
|
||||
updateTime: number;
|
||||
@@ -39,6 +41,7 @@ export type AppListItemType = {
|
||||
name: string;
|
||||
avatar: string;
|
||||
intro: string;
|
||||
type: AppTypeEnum;
|
||||
defaultPermission: PermissionValueType;
|
||||
permission: AppPermission;
|
||||
};
|
||||
|
@@ -21,7 +21,7 @@ export const getDefaultAppForm = (): AppSimpleEditFormType => ({
|
||||
limit: 1500,
|
||||
searchMode: DatasetSearchModeEnum.embedding,
|
||||
usingReRank: false,
|
||||
datasetSearchUsingExtensionQuery: true,
|
||||
datasetSearchUsingExtensionQuery: false,
|
||||
datasetSearchExtensionBg: ''
|
||||
},
|
||||
selectedTools: [],
|
||||
|
@@ -35,7 +35,10 @@ export const RunAppModule: FlowNodeTemplateType = {
|
||||
required: true
|
||||
},
|
||||
Input_Template_History,
|
||||
Input_Template_UserChatInput
|
||||
{
|
||||
...Input_Template_UserChatInput,
|
||||
toolDescription: '用户问题'
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
|
@@ -105,8 +105,8 @@ export type NodeSourceNodeItemType = {
|
||||
/* --------------- function type -------------------- */
|
||||
export type SelectAppItemType = {
|
||||
id: string;
|
||||
name: string;
|
||||
logo: string;
|
||||
// name: string;
|
||||
// logo?: string;
|
||||
};
|
||||
|
||||
/* agent */
|
||||
|
@@ -17,4 +17,4 @@ export const AppPermissionList: PermissionListType = {
|
||||
}
|
||||
};
|
||||
|
||||
export const AppDefaultPermission = NullPermission;
|
||||
export const AppDefaultPermissionVal = NullPermission;
|
||||
|
@@ -1,14 +1,14 @@
|
||||
import { PerConstructPros, Permission } from '../controller';
|
||||
import { AppDefaultPermission } from './constant';
|
||||
import { AppDefaultPermissionVal } from './constant';
|
||||
|
||||
export class AppPermission extends Permission {
|
||||
constructor(props?: PerConstructPros) {
|
||||
if (!props) {
|
||||
props = {
|
||||
per: AppDefaultPermission
|
||||
per: AppDefaultPermissionVal
|
||||
};
|
||||
} else if (!props?.per) {
|
||||
props.per = AppDefaultPermission;
|
||||
props.per = AppDefaultPermissionVal;
|
||||
}
|
||||
super(props);
|
||||
}
|
||||
|
@@ -1,9 +1,10 @@
|
||||
import { Permission } from './controller';
|
||||
import { PermissionValueType } from './type';
|
||||
|
||||
export type CollaboratorItemType = {
|
||||
teamId: string;
|
||||
tmbId: string;
|
||||
permission: PermissionValueType;
|
||||
permission: Permission;
|
||||
name: string;
|
||||
avatar: string;
|
||||
};
|
||||
|
@@ -9,7 +9,7 @@ export const TeamPermissionList = {
|
||||
},
|
||||
[PermissionKeyEnum.manage]: {
|
||||
...PermissionList[PermissionKeyEnum.manage],
|
||||
description: '可邀请, 删除成员'
|
||||
description: '可创建资源、邀请、删除成员'
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user