mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 13:53:50 +00:00
4.8.6 merge (#1943)
* Dataset collection forbid (#1885) * perf: tool call support same id * feat: collection forbid * feat: collection forbid * Inheritance Permission for apps (#1897) * feat: app schema define chore: references of authapp * feat: authApp method inheritance * feat: create and update api * feat: update * feat: inheritance Permission controller for app. * feat: abstract version of inheritPermission * feat: ancestorId for apps * chore: update app * fix: inheritPermission abstract version * feat: update folder defaultPermission * feat: app update api * chore: inheritance frontend * chore: app list api * feat: update defaultPermission in app deatil * feat: backend api finished * feat: app inheritance permission fe * fix: app update defaultpermission causes collaborator miss * fix: ts error * chore: adjust the codes * chore: i18n chore: i18n * chore: fe adjust and i18n * chore: adjust the code * feat: resume api; chore: rewrite update api and inheritPermission methods * chore: something * chore: fe code adjusting * feat: frontend adjusting * chore: fe code adjusting * chore: adjusting the code * perf: fe loading * format * Inheritance fix (#1908) * fix: SlideCard * fix: authapp did not return parent app for inheritance app * fix: fe adjusting * feat: fe adjusing * perf: inherit per ux * doc * fix: ts errors (#1916) * perf: inherit permission * fix: permission inherit * Workflow type (#1938) * perf: workflow type tmp workflow perf: workflow type feat: custom field config * perf: dynamic input * perf: node classify * perf: node classify * perf: node classify * perf: node classify * fix: workflow custom input * feat: text editor and customFeedback move to basic nodes * feat: community system plugin * fix: ts * feat: exprEval plugin * perf: workflow type * perf: plugin important * fix: default templates * perf: markdown hr css * lock * perf: fetch url * perf: new plugin version * fix: chat histories update * fix: collection paths invalid * perf: app card ui --------- Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
This commit is contained in:
@@ -5,7 +5,8 @@ const startCode = 507000;
|
||||
export enum CommonErrEnum {
|
||||
fileNotFound = 'fileNotFound',
|
||||
unAuthFile = 'unAuthFile',
|
||||
missingParams = 'missingParams'
|
||||
missingParams = 'missingParams',
|
||||
inheritPermissionError = 'inheritPermissionError'
|
||||
}
|
||||
const datasetErr = [
|
||||
{
|
||||
@@ -19,6 +20,10 @@ const datasetErr = [
|
||||
{
|
||||
statusText: CommonErrEnum.missingParams,
|
||||
message: 'error.missingParams'
|
||||
},
|
||||
{
|
||||
statusText: CommonErrEnum.inheritPermissionError,
|
||||
message: 'error.inheritPermissionError'
|
||||
}
|
||||
];
|
||||
export default datasetErr.reduce((acc, cur, index) => {
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import dayjs from 'dayjs';
|
||||
import cronParser from 'cron-parser';
|
||||
|
||||
export const formatTime2YMDHMW = (time?: Date) => dayjs(time).format('YYYY-MM-DD HH:mm:ss dddd');
|
||||
export const formatTime2YMDHM = (time?: Date) =>
|
||||
time ? dayjs(time).format('YYYY-MM-DD HH:mm') : '';
|
||||
export const formatTime2YMD = (time?: Date) => (time ? dayjs(time).format('YYYY-MM-DD') : '');
|
||||
|
@@ -8,6 +8,8 @@ export enum AppTypeEnum {
|
||||
httpPlugin = 'httpPlugin'
|
||||
}
|
||||
|
||||
export const AppFolderTypeList = [AppTypeEnum.folder, AppTypeEnum.httpPlugin];
|
||||
|
||||
export const defaultTTSConfig: AppTTSConfigType = { type: 'web' };
|
||||
|
||||
export const defaultWhisperConfig: AppWhisperConfigType = {
|
||||
|
@@ -4,12 +4,12 @@ import yaml from 'js-yaml';
|
||||
import { OpenAPIV3 } from 'openapi-types';
|
||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from '../../workflow/type/io';
|
||||
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum } from '../../workflow/node/constant';
|
||||
import { NodeInputKeyEnum, WorkflowIOValueTypeEnum } from '../../workflow/constants';
|
||||
import { WorkflowIOValueTypeEnum } from '../../workflow/constants';
|
||||
import { PluginInputModule } from '../../workflow/template/system/pluginInput';
|
||||
import { PluginOutputModule } from '../../workflow/template/system/pluginOutput';
|
||||
import { HttpModule468 } from '../../workflow/template/system/http468';
|
||||
import { HttpNode468 } from '../../workflow/template/system/http468';
|
||||
import { HttpParamAndHeaderItemType } from '../../workflow/api';
|
||||
import { StoreNodeItemType } from '../../workflow/type';
|
||||
import { StoreNodeItemType } from '../../workflow/type/node';
|
||||
import { HttpImgUrl } from '../../../common/file/image/constants';
|
||||
import SwaggerParser from '@apidevtools/swagger-parser';
|
||||
import { getHandleId } from '../../workflow/utils';
|
||||
@@ -116,16 +116,7 @@ export const httpApiSchema2Plugins = async ({
|
||||
required: param.required,
|
||||
description: param.description,
|
||||
toolDescription: param.description,
|
||||
canEdit: true,
|
||||
editField: {
|
||||
key: true,
|
||||
name: true,
|
||||
description: true,
|
||||
required: true,
|
||||
dataType: true,
|
||||
inputType: true,
|
||||
isToolInput: true
|
||||
}
|
||||
canEdit: true
|
||||
};
|
||||
}) || []),
|
||||
...(propsKeys?.map((key) => {
|
||||
@@ -138,16 +129,7 @@ export const httpApiSchema2Plugins = async ({
|
||||
required: false,
|
||||
description: prop.description,
|
||||
toolDescription: prop.description,
|
||||
canEdit: true,
|
||||
editField: {
|
||||
key: true,
|
||||
name: true,
|
||||
description: true,
|
||||
required: true,
|
||||
dataType: true,
|
||||
inputType: true,
|
||||
isToolInput: true
|
||||
}
|
||||
canEdit: true
|
||||
};
|
||||
}) || [])
|
||||
];
|
||||
@@ -186,10 +168,6 @@ export const httpApiSchema2Plugins = async ({
|
||||
label: param.name,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
||||
canEdit: true,
|
||||
editField: {
|
||||
key: true,
|
||||
valueType: true
|
||||
},
|
||||
value: [pluginInputId, inputIdMap.get(param.name)]
|
||||
};
|
||||
}) || []),
|
||||
@@ -200,10 +178,6 @@ export const httpApiSchema2Plugins = async ({
|
||||
label: key,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
||||
canEdit: true,
|
||||
editField: {
|
||||
key: true,
|
||||
valueType: true
|
||||
},
|
||||
value: [pluginInputId, inputIdMap.get(key)]
|
||||
};
|
||||
}) || [])
|
||||
@@ -271,7 +245,7 @@ export const httpApiSchema2Plugins = async ({
|
||||
}
|
||||
|
||||
/* Combine complete modules */
|
||||
const modules: StoreNodeItemType[] = [
|
||||
const nodes: StoreNodeItemType[] = [
|
||||
{
|
||||
nodeId: pluginInputId,
|
||||
name: PluginInputModule.name,
|
||||
@@ -280,8 +254,8 @@ export const httpApiSchema2Plugins = async ({
|
||||
flowNodeType: PluginInputModule.flowNodeType,
|
||||
showStatus: PluginInputModule.showStatus,
|
||||
position: {
|
||||
x: 616.4226348688949,
|
||||
y: -165.05298493910115
|
||||
x: 473.55206291900333,
|
||||
y: -145.65080850146154
|
||||
},
|
||||
version: PluginInputModule.version,
|
||||
inputs: pluginInputs,
|
||||
@@ -295,8 +269,8 @@ export const httpApiSchema2Plugins = async ({
|
||||
flowNodeType: PluginOutputModule.flowNodeType,
|
||||
showStatus: PluginOutputModule.showStatus,
|
||||
position: {
|
||||
x: 1607.7142331269126,
|
||||
y: -151.8669210746189
|
||||
x: 1847.5956872650024,
|
||||
y: 5.114324648101558
|
||||
},
|
||||
version: PluginOutputModule.version,
|
||||
inputs: [
|
||||
@@ -308,11 +282,6 @@ export const httpApiSchema2Plugins = async ({
|
||||
required: false,
|
||||
description: '',
|
||||
canEdit: true,
|
||||
editField: {
|
||||
key: true,
|
||||
description: true,
|
||||
valueType: true
|
||||
},
|
||||
value: [httpId, 'httpRawResponse']
|
||||
}
|
||||
],
|
||||
@@ -328,29 +297,18 @@ export const httpApiSchema2Plugins = async ({
|
||||
},
|
||||
{
|
||||
nodeId: httpId,
|
||||
name: HttpModule468.name,
|
||||
intro: HttpModule468.intro,
|
||||
avatar: HttpModule468.avatar,
|
||||
flowNodeType: HttpModule468.flowNodeType,
|
||||
name: HttpNode468.name,
|
||||
intro: HttpNode468.intro,
|
||||
avatar: HttpNode468.avatar,
|
||||
flowNodeType: HttpNode468.flowNodeType,
|
||||
showStatus: true,
|
||||
position: {
|
||||
x: 1042.549746602742,
|
||||
y: -447.77496332641647
|
||||
x: 1188.947986995841,
|
||||
y: -473.52694296182904
|
||||
},
|
||||
version: HttpModule468.version,
|
||||
version: HttpNode468.version,
|
||||
inputs: [
|
||||
{
|
||||
key: NodeInputKeyEnum.addInputParam,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.addInputParam],
|
||||
valueType: WorkflowIOValueTypeEnum.dynamic,
|
||||
label: '',
|
||||
required: false,
|
||||
description: 'core.module.input.description.HTTP Dynamic Input',
|
||||
editField: {
|
||||
key: true,
|
||||
valueType: true
|
||||
}
|
||||
},
|
||||
HttpNode468.inputs[0],
|
||||
...httpInputs,
|
||||
{
|
||||
key: 'system_httpMethod',
|
||||
@@ -397,7 +355,7 @@ export const httpApiSchema2Plugins = async ({
|
||||
required: false
|
||||
}
|
||||
],
|
||||
outputs: HttpModule468.outputs
|
||||
outputs: HttpNode468.outputs
|
||||
}
|
||||
];
|
||||
|
||||
@@ -422,7 +380,7 @@ export const httpApiSchema2Plugins = async ({
|
||||
intro: item.description,
|
||||
parentId,
|
||||
type: AppTypeEnum.plugin,
|
||||
modules,
|
||||
modules: nodes,
|
||||
edges,
|
||||
pluginData: {
|
||||
pluginUniId: item.name
|
||||
|
12
packages/global/core/app/type.d.ts
vendored
12
packages/global/core/app/type.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
import type { FlowNodeTemplateType, StoreNodeItemType } from '../workflow/type';
|
||||
import type { FlowNodeTemplateType, StoreNodeItemType } from '../workflow/type/node';
|
||||
import { AppTypeEnum } from './constants';
|
||||
import { PermissionTypeEnum } from '../../support/permission/constant';
|
||||
import { VariableInputEnum } from '../workflow/constants';
|
||||
@@ -6,7 +6,7 @@ import { SelectedDatasetType } from '../workflow/api';
|
||||
import { DatasetSearchModeEnum } from '../dataset/constants';
|
||||
import { TeamTagSchema as TeamTagsSchemaType } from '@fastgpt/global/support/user/team/type.d';
|
||||
import { StoreEdgeItemType } from '../workflow/type/edge';
|
||||
import { PermissionValueType } from '../../support/permission/type';
|
||||
import { PermissionSchemaType, PermissionValueType } from '../../support/permission/type';
|
||||
import { AppPermission } from '../../support/permission/app/controller';
|
||||
import { ParentIdType } from '../../common/parentFolder/type';
|
||||
|
||||
@@ -39,8 +39,7 @@ export type AppSchema = {
|
||||
|
||||
inited?: boolean;
|
||||
teamTags: string[];
|
||||
defaultPermission: PermissionValueType;
|
||||
};
|
||||
} & PermissionSchemaType;
|
||||
|
||||
export type AppListItemType = {
|
||||
_id: string;
|
||||
@@ -50,10 +49,9 @@ export type AppListItemType = {
|
||||
intro: string;
|
||||
type: AppTypeEnum;
|
||||
updateTime: Date;
|
||||
defaultPermission: PermissionValueType;
|
||||
permission: AppPermission;
|
||||
pluginData?: AppSchema['pluginData'];
|
||||
};
|
||||
permission: AppPermission;
|
||||
} & PermissionSchemaType;
|
||||
|
||||
export type AppDetailType = AppSchema & {
|
||||
permission: AppPermission;
|
||||
|
@@ -3,7 +3,7 @@ import { FlowNodeTypeEnum } from '../workflow/node/constant';
|
||||
import { NodeInputKeyEnum, FlowNodeTemplateTypeEnum } from '../workflow/constants';
|
||||
import type { FlowNodeInputItemType } from '../workflow/type/io.d';
|
||||
import { getAppChatConfig } from '../workflow/utils';
|
||||
import { StoreNodeItemType } from '../workflow/type';
|
||||
import { StoreNodeItemType } from '../workflow/type/node';
|
||||
import { DatasetSearchModeEnum } from '../dataset/constants';
|
||||
|
||||
export const getDefaultAppForm = (): AppSimpleEditFormType => ({
|
||||
|
1
packages/global/core/app/version.d.ts
vendored
1
packages/global/core/app/version.d.ts
vendored
@@ -1,4 +1,3 @@
|
||||
import { StoreNodeItemType } from '../workflow/type';
|
||||
import { StoreEdgeItemType } from '../workflow/type/edge';
|
||||
import { AppChatConfigType, AppSchema } from './type';
|
||||
|
||||
|
2
packages/global/core/chat/type.d.ts
vendored
2
packages/global/core/chat/type.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
import { ClassifyQuestionAgentItemType } from '../workflow/type';
|
||||
import { ClassifyQuestionAgentItemType } from '../workflow/template/system/classifyQuestion/type';
|
||||
import { SearchDataResponseItemType } from '../dataset/type';
|
||||
import {
|
||||
ChatFileTypeEnum,
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import { DatasetCollectionTypeEnum, TrainingModeEnum, TrainingTypeMap } from '../constants';
|
||||
import { CollectionWithDatasetType, DatasetCollectionSchemaType } from '../type';
|
||||
|
||||
export const getCollectionSourceData = (
|
||||
@@ -12,3 +13,13 @@ export const getCollectionSourceData = (
|
||||
sourceName: collection?.name || ''
|
||||
};
|
||||
};
|
||||
|
||||
export const checkCollectionIsFolder = (type: DatasetCollectionTypeEnum) => {
|
||||
return type === DatasetCollectionTypeEnum.folder || type === DatasetCollectionTypeEnum.virtual;
|
||||
};
|
||||
|
||||
export const getTrainingTypeLabel = (type?: TrainingModeEnum) => {
|
||||
if (!type) return '';
|
||||
if (!TrainingTypeMap[type]) return '';
|
||||
return TrainingTypeMap[type].label;
|
||||
};
|
||||
|
5
packages/global/core/dataset/type.d.ts
vendored
5
packages/global/core/dataset/type.d.ts
vendored
@@ -27,7 +27,7 @@ export type DatasetSchemaType = {
|
||||
intro: string;
|
||||
type: DatasetTypeEnum;
|
||||
status: `${DatasetStatusEnum}`;
|
||||
permission: DatasetPermission;
|
||||
// permission: DatasetPermission;
|
||||
|
||||
// metadata
|
||||
websiteConfig?: {
|
||||
@@ -48,6 +48,7 @@ export type DatasetCollectionSchemaType = {
|
||||
type: DatasetCollectionTypeEnum;
|
||||
createTime: Date;
|
||||
updateTime: Date;
|
||||
forbid?: boolean;
|
||||
|
||||
trainingType: TrainingModeEnum;
|
||||
chunkSize: number;
|
||||
@@ -89,6 +90,7 @@ export type DatasetDataSchemaType = {
|
||||
updateTime: Date;
|
||||
q: string; // large chunks or question
|
||||
a: string; // answer or custom content
|
||||
forbid?: boolean;
|
||||
fullTextToken: string;
|
||||
indexes: DatasetDataIndexItemType[];
|
||||
rebuilding?: boolean;
|
||||
@@ -144,6 +146,7 @@ export type DatasetListItemType = {
|
||||
export type DatasetItemType = Omit<DatasetSchemaType, 'vectorModel' | 'agentModel'> & {
|
||||
vectorModel: VectorModelItemType;
|
||||
agentModel: LLMModelItemType;
|
||||
permission: DatasetPermission;
|
||||
};
|
||||
|
||||
/* ================= collection ===================== */
|
||||
|
@@ -1,5 +1,3 @@
|
||||
import { StoreNodeItemType } from '../workflow/type';
|
||||
|
||||
export enum PluginTypeEnum {
|
||||
folder = 'folder',
|
||||
custom = 'custom',
|
||||
|
2
packages/global/core/plugin/controller.d.ts
vendored
2
packages/global/core/plugin/controller.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
import { StoreEdgeItemType } from 'core/workflow/type/edge';
|
||||
import type { StoreNodeItemType } from '../workflow/type';
|
||||
import type { StoreNodeItemType } from '../workflow/type/node';
|
||||
import { PluginTypeEnum } from './constants';
|
||||
import { HttpAuthMethodType } from '../app/httpPlugin/type';
|
||||
|
||||
|
3
packages/global/core/plugin/type.d.ts
vendored
3
packages/global/core/plugin/type.d.ts
vendored
@@ -1,8 +1,9 @@
|
||||
import { StoreEdgeItemType } from 'core/workflow/type/edge';
|
||||
import { ModuleTemplateTypeEnum } from '../workflow/constants';
|
||||
import type { FlowModuleTemplateType, StoreNodeItemType } from '../workflow/type';
|
||||
import type { StoreNodeItemType } from '../workflow/type/node';
|
||||
import { PluginSourceEnum, PluginTypeEnum } from './constants';
|
||||
import { MethodType } from './controller';
|
||||
import { FlowNodeTemplateType } from '../workflow/type/node';
|
||||
|
||||
export type PluginItemSchema = {
|
||||
_id: string;
|
||||
|
2
packages/global/core/workflow/api.d.ts
vendored
2
packages/global/core/workflow/api.d.ts
vendored
@@ -4,7 +4,7 @@ import { NodeInputKeyEnum } from './constants';
|
||||
export type SelectedDatasetType = { datasetId: string }[];
|
||||
|
||||
export type HttpBodyType<T = Record<string, any>> = {
|
||||
[NodeInputKeyEnum.addInputParam]: Record<string, any>;
|
||||
// [NodeInputKeyEnum.addInputParam]: Record<string, any>;
|
||||
} & T;
|
||||
export type HttpQueryType = {
|
||||
appId: string;
|
||||
|
@@ -1,13 +1,11 @@
|
||||
export enum FlowNodeTemplateTypeEnum {
|
||||
systemInput = 'systemInput',
|
||||
ai = 'ai',
|
||||
function = 'function',
|
||||
tools = 'tools',
|
||||
textAnswer = 'textAnswer',
|
||||
functionCall = 'functionCall',
|
||||
externalCall = 'externalCall',
|
||||
|
||||
personalPlugin = 'personalPlugin',
|
||||
|
||||
other = 'other'
|
||||
other = 'other',
|
||||
teamApp = 'teamApp'
|
||||
}
|
||||
|
||||
export enum WorkflowIOValueTypeEnum {
|
||||
@@ -84,6 +82,9 @@ export enum NodeInputKeyEnum {
|
||||
datasetSearchExtensionModel = 'datasetSearchExtensionModel',
|
||||
datasetSearchExtensionBg = 'datasetSearchExtensionBg',
|
||||
|
||||
// concat dataset
|
||||
datasetQuoteList = 'system_datasetQuoteList',
|
||||
|
||||
// context extract
|
||||
contextExtractInput = 'content',
|
||||
extractKeys = 'extractKeys',
|
||||
@@ -180,8 +181,6 @@ export const variableMap = {
|
||||
}
|
||||
};
|
||||
|
||||
export const DYNAMIC_INPUT_REFERENCE_KEY = 'DYNAMIC_INPUT_REFERENCE_KEY';
|
||||
|
||||
/* run time */
|
||||
export enum RuntimeEdgeStatusEnum {
|
||||
'waiting' = 'waiting',
|
||||
@@ -190,3 +189,4 @@ export enum RuntimeEdgeStatusEnum {
|
||||
}
|
||||
|
||||
export const VARIABLE_NODE_ID = 'VARIABLE_NODE_ID';
|
||||
export const DYNAMIC_INPUT_REFERENCE_KEY = 'DYNAMIC_INPUT_REFERENCE_KEY';
|
||||
|
@@ -1,8 +1,11 @@
|
||||
import { WorkflowIOValueTypeEnum } from '../constants';
|
||||
|
||||
export enum FlowNodeInputTypeEnum { // render ui
|
||||
reference = 'reference', // reference to other node output
|
||||
input = 'input', // one line input
|
||||
numberInput = 'numberInput',
|
||||
switch = 'switch', // true/false
|
||||
select = 'select',
|
||||
|
||||
// editor
|
||||
textarea = 'textarea',
|
||||
@@ -22,8 +25,6 @@ export enum FlowNodeInputTypeEnum { // render ui
|
||||
selectDatasetParamsModal = 'selectDatasetParamsModal',
|
||||
settingDatasetQuotePrompt = 'settingDatasetQuotePrompt',
|
||||
|
||||
select = 'select',
|
||||
|
||||
hidden = 'hidden',
|
||||
custom = 'custom'
|
||||
}
|
||||
@@ -114,8 +115,97 @@ export enum FlowNodeTypeEnum {
|
||||
lafModule = 'lafModule',
|
||||
ifElseNode = 'ifElseNode',
|
||||
variableUpdate = 'variableUpdate',
|
||||
code = 'code'
|
||||
code = 'code',
|
||||
textEditor = 'textEditor',
|
||||
customFeedback = 'customFeedback'
|
||||
}
|
||||
|
||||
// node IO value type
|
||||
export const FlowValueTypeMap = {
|
||||
[WorkflowIOValueTypeEnum.string]: {
|
||||
label: 'string',
|
||||
value: WorkflowIOValueTypeEnum.string,
|
||||
description: ''
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.number]: {
|
||||
label: 'number',
|
||||
value: WorkflowIOValueTypeEnum.number,
|
||||
description: ''
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.boolean]: {
|
||||
label: 'boolean',
|
||||
value: WorkflowIOValueTypeEnum.boolean,
|
||||
description: ''
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.object]: {
|
||||
label: 'object',
|
||||
value: WorkflowIOValueTypeEnum.object,
|
||||
description: ''
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.arrayString]: {
|
||||
label: 'array<string>',
|
||||
value: WorkflowIOValueTypeEnum.arrayString,
|
||||
description: ''
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.arrayNumber]: {
|
||||
label: 'array<number>',
|
||||
value: WorkflowIOValueTypeEnum.arrayNumber,
|
||||
description: ''
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.arrayBoolean]: {
|
||||
label: 'array<boolean>',
|
||||
value: WorkflowIOValueTypeEnum.arrayBoolean,
|
||||
description: ''
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.arrayObject]: {
|
||||
label: 'array<object>',
|
||||
value: WorkflowIOValueTypeEnum.arrayObject,
|
||||
description: ''
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.any]: {
|
||||
label: 'any',
|
||||
value: WorkflowIOValueTypeEnum.any,
|
||||
description: ''
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.chatHistory]: {
|
||||
label: '历史记录',
|
||||
value: WorkflowIOValueTypeEnum.chatHistory,
|
||||
description: `{
|
||||
obj: System | Human | AI;
|
||||
value: string;
|
||||
}[]`
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.datasetQuote]: {
|
||||
label: '知识库引用',
|
||||
value: WorkflowIOValueTypeEnum.datasetQuote,
|
||||
description: `{
|
||||
id: string;
|
||||
datasetId: string;
|
||||
collectionId: string;
|
||||
sourceName: string;
|
||||
sourceId?: string;
|
||||
q: string;
|
||||
a: string
|
||||
}[]`
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.selectApp]: {
|
||||
label: '选择应用',
|
||||
value: WorkflowIOValueTypeEnum.selectApp,
|
||||
description: ''
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.selectDataset]: {
|
||||
label: '选择知识库',
|
||||
value: WorkflowIOValueTypeEnum.selectDataset,
|
||||
description: `{
|
||||
datasetId: string;
|
||||
}`
|
||||
},
|
||||
[WorkflowIOValueTypeEnum.dynamic]: {
|
||||
label: '动态输入',
|
||||
value: WorkflowIOValueTypeEnum.dynamic,
|
||||
description: ''
|
||||
}
|
||||
};
|
||||
|
||||
export const EDGE_TYPE = 'default';
|
||||
export const defaultNodeVersion = '481';
|
||||
|
17
packages/global/core/workflow/node/io/utils.ts
Normal file
17
packages/global/core/workflow/node/io/utils.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { FlowNodeInputItemType } from '../../type/io';
|
||||
|
||||
export const getInputComponentProps = (input: FlowNodeInputItemType) => {
|
||||
return {
|
||||
referencePlaceholder: input.referencePlaceholder,
|
||||
placeholder: input.placeholder,
|
||||
maxLength: input.maxLength,
|
||||
list: input.list,
|
||||
markList: input.markList,
|
||||
step: input.step,
|
||||
max: input.max,
|
||||
min: input.min,
|
||||
defaultValue: input.defaultValue,
|
||||
llmModelType: input.llmModelType,
|
||||
customInputConfig: input.customInputConfig
|
||||
};
|
||||
};
|
39
packages/global/core/workflow/node/type.d.ts
vendored
39
packages/global/core/workflow/node/type.d.ts
vendored
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
react flow type
|
||||
*/
|
||||
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum, FlowNodeTypeEnum } from './constant';
|
||||
import { WorkflowIOValueTypeEnum, NodeInputKeyEnum, NodeOutputKeyEnum } from '../constants';
|
||||
import { SelectedDatasetType } from '../api';
|
||||
import { LLMModelTypeEnum } from '../../ai/constants';
|
||||
|
||||
/* --------------- edit field ------------------- */
|
||||
export type EditInputFieldMapType = EditOutputFieldMapType & {
|
||||
inputType?: boolean;
|
||||
};
|
||||
export type EditOutputFieldMapType = {
|
||||
key?: boolean;
|
||||
description?: boolean;
|
||||
valueType?: boolean; // output
|
||||
required?: boolean;
|
||||
defaultValue?: boolean;
|
||||
};
|
||||
export type EditNodeFieldType = {
|
||||
inputType?: FlowNodeInputTypeEnum; // input type
|
||||
valueType?: WorkflowIOValueTypeEnum;
|
||||
required?: boolean;
|
||||
key?: string;
|
||||
label?: string;
|
||||
description?: string;
|
||||
isToolInput?: boolean;
|
||||
|
||||
defaultValue?: string;
|
||||
maxLength?: number;
|
||||
max?: number;
|
||||
min?: number;
|
||||
editField?: EditInputFieldMapType;
|
||||
dynamicParamDefaultValue?: {
|
||||
inputType?: FlowNodeInputTypeEnum; // input type
|
||||
valueType?: WorkflowIOValueTypeEnum;
|
||||
required?: boolean;
|
||||
};
|
||||
};
|
59
packages/global/core/workflow/runtime/type.d.ts
vendored
59
packages/global/core/workflow/runtime/type.d.ts
vendored
@@ -1,11 +1,56 @@
|
||||
import { ChatNodeUsageType } from '../../../support/wallet/bill/type';
|
||||
import { ChatItemValueItemType, ToolRunResponseItemType } from '../../chat/type';
|
||||
import {
|
||||
ChatItemType,
|
||||
UserChatItemValueItemType,
|
||||
ChatItemValueItemType,
|
||||
ToolRunResponseItemType
|
||||
} from '../../chat/type';
|
||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from '../type/io.d';
|
||||
import { StoreNodeItemType } from '../type';
|
||||
import { StoreNodeItemType } from '../type/node';
|
||||
import { DispatchNodeResponseKeyEnum } from './constants';
|
||||
import { StoreEdgeItemType } from '../type/edge';
|
||||
import { NodeInputKeyEnum } from '../constants';
|
||||
import { ClassifyQuestionAgentItemType } from '../template/system/classifyQuestion/type';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { UserModelSchema } from '../../../support/user/type';
|
||||
import { AppDetailType, AppSchema } from '../../app/type';
|
||||
import { RuntimeNodeItemType } from '../runtime/type';
|
||||
import { RuntimeEdgeItemType } from './edge';
|
||||
|
||||
/* workflow props */
|
||||
export type ChatDispatchProps = {
|
||||
res?: NextApiResponse;
|
||||
mode: 'test' | 'chat' | 'debug';
|
||||
teamId: string;
|
||||
tmbId: string;
|
||||
user: UserModelSchema;
|
||||
app: AppDetailType | AppSchema;
|
||||
chatId?: string;
|
||||
responseChatItemId?: string;
|
||||
histories: ChatItemType[];
|
||||
variables: Record<string, any>; // global variable
|
||||
query: UserChatItemValueItemType[]; // trigger query
|
||||
stream: boolean;
|
||||
detail: boolean; // response detail
|
||||
maxRunTimes: number;
|
||||
isToolCall?: boolean;
|
||||
};
|
||||
|
||||
export type ModuleDispatchProps<T> = ChatDispatchProps & {
|
||||
node: RuntimeNodeItemType;
|
||||
runtimeNodes: RuntimeNodeItemType[];
|
||||
runtimeEdges: RuntimeEdgeItemType[];
|
||||
params: T;
|
||||
};
|
||||
|
||||
export type SystemVariablesType = {
|
||||
appId: string;
|
||||
chatId?: string;
|
||||
responseChatItemId?: string;
|
||||
histories: ChatItemType[];
|
||||
};
|
||||
|
||||
/* node props */
|
||||
export type RuntimeNodeItemType = {
|
||||
nodeId: StoreNodeItemType['nodeId'];
|
||||
name: StoreNodeItemType['name'];
|
||||
@@ -21,6 +66,16 @@ export type RuntimeNodeItemType = {
|
||||
pluginId?: string;
|
||||
};
|
||||
|
||||
export type PluginRuntimeType = {
|
||||
teamId?: string;
|
||||
name: string;
|
||||
avatar: string;
|
||||
showStatus?: boolean;
|
||||
isTool?: boolean;
|
||||
nodes: StoreNodeItemType[];
|
||||
edges: StoreEdgeItemType[];
|
||||
};
|
||||
|
||||
export type RuntimeEdgeItemType = StoreEdgeItemType & {
|
||||
status: 'waiting' | 'active' | 'skipped';
|
||||
};
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { ChatCompletionRequestMessageRoleEnum } from '../../ai/constants';
|
||||
import { NodeInputKeyEnum, NodeOutputKeyEnum } from '../constants';
|
||||
import { FlowNodeTypeEnum } from '../node/constant';
|
||||
import { StoreNodeItemType } from '../type';
|
||||
import { StoreNodeItemType } from '../type/node';
|
||||
import { StoreEdgeItemType } from '../type/edge';
|
||||
import { RuntimeEdgeItemType, RuntimeNodeItemType } from './type';
|
||||
import { VARIABLE_NODE_ID } from '../constants';
|
||||
|
@@ -5,47 +5,51 @@ import { AiChatModule } from './system/aiChat';
|
||||
import { DatasetSearchModule } from './system/datasetSearch';
|
||||
import { DatasetConcatModule } from './system/datasetConcat';
|
||||
import { AssignedAnswerModule } from './system/assignedAnswer';
|
||||
import { ClassifyQuestionModule } from './system/classifyQuestion';
|
||||
import { ContextExtractModule } from './system/contextExtract';
|
||||
import { HttpModule468 } from './system/http468';
|
||||
import { ClassifyQuestionModule } from './system/classifyQuestion/index';
|
||||
import { ContextExtractModule } from './system/contextExtract/index';
|
||||
import { HttpNode468 } from './system/http468';
|
||||
|
||||
import { ToolModule } from './system/tools';
|
||||
import { StopToolNode } from './system/stopTool';
|
||||
|
||||
import { RunAppModule } from './system/runApp';
|
||||
import { RunAppModule } from './system/runApp/index';
|
||||
import { PluginInputModule } from './system/pluginInput';
|
||||
import { PluginOutputModule } from './system/pluginOutput';
|
||||
import { RunPluginModule } from './system/runPlugin';
|
||||
import { AiQueryExtension } from './system/queryExtension';
|
||||
|
||||
import type { FlowNodeTemplateType } from '../type';
|
||||
import type { FlowNodeTemplateType } from '../type/node';
|
||||
import { LafModule } from './system/laf';
|
||||
import { IfElseNode } from './system/ifElse/index';
|
||||
import { VariableUpdateNode } from './system/variableUpdate';
|
||||
import { CodeNode } from './system/sandbox';
|
||||
import { TextEditorNode } from './system/textEditor';
|
||||
import { CustomFeedbackNode } from './system/customFeedback';
|
||||
|
||||
const systemNodes: FlowNodeTemplateType[] = [
|
||||
AiChatModule,
|
||||
TextEditorNode,
|
||||
AssignedAnswerModule,
|
||||
DatasetSearchModule,
|
||||
DatasetConcatModule,
|
||||
RunAppModule,
|
||||
ToolModule,
|
||||
StopToolNode,
|
||||
ClassifyQuestionModule,
|
||||
ContextExtractModule,
|
||||
HttpModule468,
|
||||
HttpNode468,
|
||||
AiQueryExtension,
|
||||
LafModule,
|
||||
IfElseNode,
|
||||
VariableUpdateNode,
|
||||
CodeNode
|
||||
CodeNode,
|
||||
RunAppModule
|
||||
];
|
||||
/* app flow module templates */
|
||||
export const appSystemModuleTemplates: FlowNodeTemplateType[] = [
|
||||
SystemConfigNode,
|
||||
WorkflowStart,
|
||||
...systemNodes
|
||||
...systemNodes,
|
||||
CustomFeedbackNode
|
||||
];
|
||||
/* plugin flow module templates */
|
||||
export const pluginSystemModuleTemplates: FlowNodeTemplateType[] = [
|
||||
@@ -56,11 +60,11 @@ export const pluginSystemModuleTemplates: FlowNodeTemplateType[] = [
|
||||
|
||||
/* all module */
|
||||
export const moduleTemplatesFlat: FlowNodeTemplateType[] = [
|
||||
...systemNodes,
|
||||
...appSystemModuleTemplates.concat(
|
||||
pluginSystemModuleTemplates.filter(
|
||||
(item) => !appSystemModuleTemplates.find((app) => app.id === item.id)
|
||||
)
|
||||
),
|
||||
EmptyNode,
|
||||
SystemConfigNode,
|
||||
WorkflowStart,
|
||||
PluginInputModule,
|
||||
PluginOutputModule,
|
||||
RunPluginModule
|
||||
];
|
||||
|
@@ -8,10 +8,5 @@ export const Output_Template_AddOutput: FlowNodeOutputItemType = {
|
||||
key: NodeOutputKeyEnum.addOutputParam,
|
||||
type: FlowNodeOutputTypeEnum.dynamic,
|
||||
valueType: WorkflowIOValueTypeEnum.dynamic,
|
||||
label: '',
|
||||
|
||||
editField: {
|
||||
key: true,
|
||||
valueType: true
|
||||
}
|
||||
label: ''
|
||||
};
|
||||
|
@@ -3,7 +3,7 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type';
|
||||
import { FlowNodeTemplateType } from '../../type/node';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
@@ -22,7 +22,7 @@ import { getHandleConfig } from '../utils';
|
||||
|
||||
export const AiChatModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.chatNode,
|
||||
templateType: FlowNodeTemplateTypeEnum.textAnswer,
|
||||
templateType: FlowNodeTemplateTypeEnum.ai,
|
||||
flowNodeType: FlowNodeTypeEnum.chatNode,
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
@@ -9,7 +9,7 @@ import { getHandleConfig } from '../utils';
|
||||
|
||||
export const AssignedAnswerModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.answerNode,
|
||||
templateType: FlowNodeTemplateTypeEnum.textAnswer,
|
||||
templateType: FlowNodeTemplateTypeEnum.tools,
|
||||
flowNodeType: FlowNodeTypeEnum.answerNode,
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
|
@@ -2,26 +2,26 @@ import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type';
|
||||
} from '../../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../../type/node';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
FlowNodeTemplateTypeEnum,
|
||||
NodeOutputKeyEnum
|
||||
} from '../../constants';
|
||||
} from '../../../constants';
|
||||
import {
|
||||
Input_Template_SelectAIModel,
|
||||
Input_Template_History,
|
||||
Input_Template_UserChatInput
|
||||
} from '../input';
|
||||
import { Input_Template_System_Prompt } from '../input';
|
||||
import { LLMModelTypeEnum } from '../../../ai/constants';
|
||||
import { getHandleConfig } from '../utils';
|
||||
} from '../../input';
|
||||
import { Input_Template_System_Prompt } from '../../input';
|
||||
import { LLMModelTypeEnum } from '../../../../ai/constants';
|
||||
import { getHandleConfig } from '../../utils';
|
||||
|
||||
export const ClassifyQuestionModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.classifyQuestion,
|
||||
templateType: FlowNodeTemplateTypeEnum.functionCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.ai,
|
||||
flowNodeType: FlowNodeTypeEnum.classifyQuestion,
|
||||
sourceHandle: getHandleConfig(false, false, false, false),
|
||||
targetHandle: getHandleConfig(true, false, true, true),
|
4
packages/global/core/workflow/template/system/classifyQuestion/type.d.ts
vendored
Normal file
4
packages/global/core/workflow/template/system/classifyQuestion/type.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export type ClassifyQuestionAgentItemType = {
|
||||
value: string;
|
||||
key: string;
|
||||
};
|
@@ -2,21 +2,21 @@ import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type';
|
||||
} from '../../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../../type/node';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
NodeOutputKeyEnum,
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../constants';
|
||||
import { Input_Template_SelectAIModel, Input_Template_History } from '../input';
|
||||
import { LLMModelTypeEnum } from '../../../ai/constants';
|
||||
import { getHandleConfig } from '../utils';
|
||||
} from '../../../constants';
|
||||
import { Input_Template_SelectAIModel, Input_Template_History } from '../../input';
|
||||
import { LLMModelTypeEnum } from '../../../../ai/constants';
|
||||
import { getHandleConfig } from '../../utils';
|
||||
|
||||
export const ContextExtractModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.contentExtract,
|
||||
templateType: FlowNodeTemplateTypeEnum.functionCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.ai,
|
||||
flowNodeType: FlowNodeTypeEnum.contentExtract,
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
8
packages/global/core/workflow/template/system/contextExtract/type.d.ts
vendored
Normal file
8
packages/global/core/workflow/template/system/contextExtract/type.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export type ContextExtractAgentItemType = {
|
||||
valueType: 'string' | 'number' | 'boolean';
|
||||
desc: string;
|
||||
key: string;
|
||||
required: boolean;
|
||||
defaultValue?: string;
|
||||
enum?: string;
|
||||
};
|
@@ -0,0 +1,30 @@
|
||||
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
FlowNodeTemplateTypeEnum,
|
||||
NodeInputKeyEnum
|
||||
} from '../../constants';
|
||||
import { getHandleConfig } from '../utils';
|
||||
|
||||
export const CustomFeedbackNode: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.customFeedback,
|
||||
templateType: FlowNodeTemplateTypeEnum.other,
|
||||
flowNodeType: FlowNodeTypeEnum.customFeedback,
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
avatar: '/imgs/workflow/customFeedback.svg',
|
||||
name: '自定义反馈',
|
||||
intro: '该模块被触发时,会给当前的对话记录增加一条反馈。可用于自动记录对话效果等。',
|
||||
version: '486',
|
||||
inputs: [
|
||||
{
|
||||
key: NodeInputKeyEnum.textareaInput,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.textarea, FlowNodeInputTypeEnum.reference],
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
required: true,
|
||||
label: '反馈的文本'
|
||||
}
|
||||
],
|
||||
outputs: []
|
||||
};
|
@@ -3,7 +3,7 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type';
|
||||
import { FlowNodeTemplateType } from '../../type/node';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
@@ -27,8 +27,7 @@ export const getOneQuoteInputTemplate = ({
|
||||
renderTypeList: [FlowNodeInputTypeEnum.reference],
|
||||
label: `引用${index}`,
|
||||
debugLabel: '知识库引用',
|
||||
canEdit: key !== defaultQuoteKey,
|
||||
description: '',
|
||||
canEdit: true,
|
||||
valueType: WorkflowIOValueTypeEnum.datasetQuote
|
||||
});
|
||||
|
||||
@@ -42,7 +41,7 @@ export const DatasetConcatModule: FlowNodeTemplateType = {
|
||||
name: '知识库搜索引用合并',
|
||||
intro: '可以将多个知识库搜索结果进行合并输出。使用 RRF 的合并方式进行最终排序输出。',
|
||||
showStatus: false,
|
||||
version: '481',
|
||||
version: '486',
|
||||
inputs: [
|
||||
{
|
||||
key: NodeInputKeyEnum.datasetMaxTokens,
|
||||
@@ -52,11 +51,11 @@ export const DatasetConcatModule: FlowNodeTemplateType = {
|
||||
valueType: WorkflowIOValueTypeEnum.number
|
||||
},
|
||||
{
|
||||
key: 'customComponent',
|
||||
key: NodeInputKeyEnum.datasetQuoteList,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.custom],
|
||||
label: ''
|
||||
},
|
||||
getOneQuoteInputTemplate({ key: defaultQuoteKey, index: 1 })
|
||||
}
|
||||
// getOneQuoteInputTemplate({ key: defaultQuoteKey, index: 1 })
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
|
@@ -3,7 +3,7 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type';
|
||||
import { FlowNodeTemplateType } from '../../type/node';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
@@ -19,7 +19,7 @@ export const Dataset_SEARCH_DESC =
|
||||
|
||||
export const DatasetSearchModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.datasetSearchNode,
|
||||
templateType: FlowNodeTemplateTypeEnum.functionCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.ai,
|
||||
flowNodeType: FlowNodeTypeEnum.datasetSearchNode,
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type';
|
||||
import { FlowNodeTemplateType } from '../../type/node';
|
||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||
import { getHandleConfig } from '../utils';
|
||||
|
||||
|
@@ -3,7 +3,7 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
@@ -14,9 +14,9 @@ import { Input_Template_DynamicInput } from '../input';
|
||||
import { Output_Template_AddOutput } from '../output';
|
||||
import { getHandleConfig } from '../utils';
|
||||
|
||||
export const HttpModule468: FlowNodeTemplateType = {
|
||||
export const HttpNode468: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.httpRequest468,
|
||||
templateType: FlowNodeTemplateTypeEnum.externalCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.tools,
|
||||
flowNodeType: FlowNodeTypeEnum.httpRequest468,
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
@@ -30,9 +30,10 @@ export const HttpModule468: FlowNodeTemplateType = {
|
||||
{
|
||||
...Input_Template_DynamicInput,
|
||||
description: 'core.module.input.description.HTTP Dynamic Input',
|
||||
editField: {
|
||||
key: true,
|
||||
valueType: true
|
||||
customInputConfig: {
|
||||
selectValueTypeList: Object.values(WorkflowIOValueTypeEnum),
|
||||
showDescription: false,
|
||||
showDefaultValue: true
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -80,7 +81,14 @@ export const HttpModule468: FlowNodeTemplateType = {
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
Output_Template_AddOutput,
|
||||
{
|
||||
...Output_Template_AddOutput,
|
||||
customFieldConfig: {
|
||||
selectValueTypeList: Object.values(WorkflowIOValueTypeEnum),
|
||||
showDescription: false,
|
||||
showDefaultValue: true
|
||||
}
|
||||
},
|
||||
{
|
||||
id: NodeOutputKeyEnum.error,
|
||||
key: NodeOutputKeyEnum.error,
|
||||
|
@@ -9,7 +9,7 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../../type';
|
||||
import { FlowNodeTemplateType } from '../../../type/node';
|
||||
import { getHandleConfig } from '../../utils';
|
||||
|
||||
export const IfElseNode: FlowNodeTemplateType = {
|
||||
|
@@ -3,7 +3,7 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
@@ -14,9 +14,15 @@ import { Input_Template_DynamicInput } from '../input';
|
||||
import { Output_Template_AddOutput } from '../output';
|
||||
import { getHandleConfig } from '../utils';
|
||||
|
||||
export const nodeLafCustomInputConfig = {
|
||||
selectValueTypeList: Object.values(WorkflowIOValueTypeEnum),
|
||||
showDescription: false,
|
||||
showDefaultValue: true
|
||||
};
|
||||
|
||||
export const LafModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.lafModule,
|
||||
templateType: FlowNodeTemplateTypeEnum.externalCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.other,
|
||||
flowNodeType: FlowNodeTypeEnum.lafModule,
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
@@ -30,10 +36,7 @@ export const LafModule: FlowNodeTemplateType = {
|
||||
{
|
||||
...Input_Template_DynamicInput,
|
||||
description: '接收前方节点的输出值作为变量,这些变量可以被 Laf 请求参数使用。',
|
||||
editField: {
|
||||
key: true,
|
||||
valueType: true
|
||||
}
|
||||
customInputConfig: nodeLafCustomInputConfig
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.httpReqUrl,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type';
|
||||
import { FlowNodeTemplateType } from '../../type/node';
|
||||
import { getHandleConfig } from '../utils';
|
||||
|
||||
export const PluginInputModule: FlowNodeTemplateType = {
|
||||
@@ -12,8 +12,8 @@ export const PluginInputModule: FlowNodeTemplateType = {
|
||||
unique: true,
|
||||
forbidDelete: true,
|
||||
avatar: '/imgs/workflow/input.png',
|
||||
name: '自定义插件输入',
|
||||
intro: '自定义配置外部输入,使用插件时,仅暴露自定义配置的输入',
|
||||
name: '插件输入',
|
||||
intro: '可以配置插件需要哪些输入,利用这些输入来运行插件',
|
||||
showStatus: false,
|
||||
version: '481',
|
||||
inputs: [],
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type';
|
||||
import { FlowNodeTemplateType } from '../../type/node';
|
||||
import { getHandleConfig } from '../utils';
|
||||
|
||||
export const PluginOutputModule: FlowNodeTemplateType = {
|
||||
|
@@ -3,7 +3,7 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
|
@@ -2,20 +2,20 @@ import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
||||
} from '../../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../../type/node.d';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
NodeOutputKeyEnum,
|
||||
FlowNodeTemplateTypeEnum
|
||||
} from '../../constants';
|
||||
import { Input_Template_History, Input_Template_UserChatInput } from '../input';
|
||||
import { getHandleConfig } from '../utils';
|
||||
} from '../../../constants';
|
||||
import { Input_Template_History, Input_Template_UserChatInput } from '../../input';
|
||||
import { getHandleConfig } from '../../utils';
|
||||
|
||||
export const RunAppModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.runApp,
|
||||
templateType: FlowNodeTemplateTypeEnum.externalCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.tools,
|
||||
flowNodeType: FlowNodeTypeEnum.runApp,
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
5
packages/global/core/workflow/template/system/runApp/type.d.ts
vendored
Normal file
5
packages/global/core/workflow/template/system/runApp/type.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export type SelectAppItemType = {
|
||||
id: string;
|
||||
// name: string;
|
||||
// logo?: string;
|
||||
};
|
@@ -1,11 +1,11 @@
|
||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type';
|
||||
import { FlowNodeTemplateType } from '../../type/node';
|
||||
import { getHandleConfig } from '../utils';
|
||||
|
||||
export const RunPluginModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.pluginModule,
|
||||
templateType: FlowNodeTemplateTypeEnum.externalCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.other,
|
||||
flowNodeType: FlowNodeTypeEnum.pluginModule,
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
|
@@ -9,7 +9,7 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../../type';
|
||||
import { FlowNodeTemplateType } from '../../../type/node';
|
||||
import { getHandleConfig } from '../../utils';
|
||||
import { Input_Template_DynamicInput } from '../../input';
|
||||
import { Output_Template_AddOutput } from '../../output';
|
||||
@@ -30,9 +30,10 @@ export const CodeNode: FlowNodeTemplateType = {
|
||||
{
|
||||
...Input_Template_DynamicInput,
|
||||
description: '这些变量会作为代码的运行的输入参数',
|
||||
editField: {
|
||||
key: true,
|
||||
valueType: true
|
||||
customInputConfig: {
|
||||
selectValueTypeList: Object.values(WorkflowIOValueTypeEnum),
|
||||
showDescription: false,
|
||||
showDefaultValue: true
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type';
|
||||
import { FlowNodeTemplateType } from '../../type/node';
|
||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||
import { getHandleConfig } from '../utils';
|
||||
|
||||
export const StopToolNode: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.stopTool,
|
||||
templateType: FlowNodeTemplateTypeEnum.functionCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.ai,
|
||||
flowNodeType: FlowNodeTypeEnum.stopTool,
|
||||
sourceHandle: getHandleConfig(false, false, false, false),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||
import { FlowNodeTemplateTypeEnum } from '../../constants';
|
||||
import { getHandleConfig } from '../utils';
|
||||
|
||||
|
54
packages/global/core/workflow/template/system/textEditor.ts
Normal file
54
packages/global/core/workflow/template/system/textEditor.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeOutputKeyEnum,
|
||||
FlowNodeTemplateTypeEnum,
|
||||
NodeInputKeyEnum
|
||||
} from '../../constants';
|
||||
import { getHandleConfig } from '../utils';
|
||||
import { Input_Template_DynamicInput } from '../input';
|
||||
|
||||
export const TextEditorNode: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.textEditor,
|
||||
templateType: FlowNodeTemplateTypeEnum.tools,
|
||||
flowNodeType: FlowNodeTypeEnum.textEditor,
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
avatar: '/imgs/workflow/textEditor.svg',
|
||||
name: '文本拼接',
|
||||
intro: '可对固定或传入的文本进行加工后输出,非字符串类型数据最终会转成字符串类型。',
|
||||
version: '486',
|
||||
inputs: [
|
||||
{
|
||||
...Input_Template_DynamicInput,
|
||||
description: '可以引用其他节点的输出,作为文本拼接的变量,通过 {{字段名}} 来引用变量',
|
||||
customInputConfig: {
|
||||
selectValueTypeList: Object.values(WorkflowIOValueTypeEnum),
|
||||
showDescription: false,
|
||||
showDefaultValue: false
|
||||
}
|
||||
},
|
||||
{
|
||||
key: NodeInputKeyEnum.textareaInput,
|
||||
renderTypeList: [FlowNodeInputTypeEnum.textarea],
|
||||
valueType: WorkflowIOValueTypeEnum.string,
|
||||
required: true,
|
||||
label: '拼接文本',
|
||||
placeholder: '可通过 {{字段名}} 来引用变量'
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
id: NodeOutputKeyEnum.text,
|
||||
key: NodeOutputKeyEnum.text,
|
||||
label: '拼接结果',
|
||||
type: FlowNodeOutputTypeEnum.static,
|
||||
valueType: WorkflowIOValueTypeEnum.string
|
||||
}
|
||||
]
|
||||
};
|
@@ -3,7 +3,7 @@ import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeOutputKeyEnum,
|
||||
@@ -23,7 +23,7 @@ import { getHandleConfig } from '../utils';
|
||||
export const ToolModule: FlowNodeTemplateType = {
|
||||
id: FlowNodeTypeEnum.tools,
|
||||
flowNodeType: FlowNodeTypeEnum.tools,
|
||||
templateType: FlowNodeTemplateTypeEnum.functionCall,
|
||||
templateType: FlowNodeTemplateTypeEnum.ai,
|
||||
sourceHandle: getHandleConfig(true, true, false, true),
|
||||
targetHandle: getHandleConfig(true, true, false, true),
|
||||
avatar: '/imgs/workflow/tool.svg',
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../../type/index.d';
|
||||
import { FlowNodeTemplateType } from '../../../type/node.d';
|
||||
import {
|
||||
FlowNodeTemplateTypeEnum,
|
||||
NodeInputKeyEnum,
|
||||
@@ -25,10 +25,6 @@ export const VariableUpdateNode: FlowNodeTemplateType = {
|
||||
valueType: WorkflowIOValueTypeEnum.any,
|
||||
label: '',
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
editField: {
|
||||
key: true,
|
||||
valueType: true
|
||||
},
|
||||
value: [
|
||||
{
|
||||
variable: ['', ''],
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { FlowNodeOutputTypeEnum, FlowNodeTypeEnum } from '../../node/constant';
|
||||
import { FlowNodeTemplateType } from '../../type/index.d';
|
||||
import { FlowNodeTemplateType } from '../../type/node.d';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeOutputKeyEnum,
|
||||
@@ -31,3 +31,6 @@ export const WorkflowStart: FlowNodeTemplateType = {
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export const isWorkflowStartOutput = (key?: string) =>
|
||||
!!WorkflowStart.outputs.find((output) => output.key === key);
|
||||
|
14
packages/global/core/workflow/type/fe.d.ts
vendored
14
packages/global/core/workflow/type/fe.d.ts
vendored
@@ -1,3 +1,5 @@
|
||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from './io';
|
||||
|
||||
export type FlowNodeChangeProps = { nodeId: string } & (
|
||||
| {
|
||||
type: 'attr'; // key: attr, value: new value
|
||||
@@ -7,16 +9,16 @@ export type FlowNodeChangeProps = { nodeId: string } & (
|
||||
| {
|
||||
type: 'updateInput'; // key: update input key, value: new input value
|
||||
key: string;
|
||||
value: any;
|
||||
value: FlowNodeInputItemType;
|
||||
}
|
||||
| {
|
||||
type: 'replaceInput'; // key: old input key, value: new input value
|
||||
key: string;
|
||||
value: any;
|
||||
value: FlowNodeInputItemType;
|
||||
}
|
||||
| {
|
||||
type: 'addInput'; // key: null, value: new input value
|
||||
value: any;
|
||||
value: FlowNodeInputItemType;
|
||||
index?: number;
|
||||
}
|
||||
| {
|
||||
@@ -26,16 +28,16 @@ export type FlowNodeChangeProps = { nodeId: string } & (
|
||||
| {
|
||||
type: 'updateOutput'; // key: update output key, value: new output value
|
||||
key: string;
|
||||
value: any;
|
||||
value: FlowNodeOutputItemType;
|
||||
}
|
||||
| {
|
||||
type: 'replaceOutput'; // key: old output key, value: new output value
|
||||
key: string;
|
||||
value: any;
|
||||
value: FlowNodeOutputItemType;
|
||||
}
|
||||
| {
|
||||
type: 'addOutput'; // key: null, value: new output value
|
||||
value: any;
|
||||
value: FlowNodeOutputItemType;
|
||||
index?: number;
|
||||
}
|
||||
| {
|
||||
|
155
packages/global/core/workflow/type/index.d.ts
vendored
155
packages/global/core/workflow/type/index.d.ts
vendored
@@ -6,148 +6,53 @@ import {
|
||||
VariableInputEnum
|
||||
} from '../constants';
|
||||
import { DispatchNodeResponseKeyEnum } from '../runtime/constants';
|
||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from './io.d';
|
||||
import { UserModelSchema } from '../../../support/user/type';
|
||||
import { CustomInputItemType, FlowNodeInputItemType, FlowNodeOutputItemType } from './io.d';
|
||||
import {
|
||||
ChatHistoryItemResType,
|
||||
ChatItemType,
|
||||
ChatItemValueItemType,
|
||||
ToolRunResponseItemType,
|
||||
UserChatItemValueItemType
|
||||
ToolRunResponseItemType
|
||||
} from '../../chat/type';
|
||||
import { ChatNodeUsageType } from '../../../support/wallet/bill/type';
|
||||
import { RuntimeNodeItemType } from '../runtime/type';
|
||||
import { PluginTypeEnum } from '../../plugin/constants';
|
||||
import { RuntimeEdgeItemType, StoreEdgeItemType } from './edge';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { AppDetailType, AppSchema } from '../../app/type';
|
||||
import { StoreEdgeItemType } from './edge';
|
||||
import { AppChatConfigType } from '../../app/type';
|
||||
import { ParentIdType } from 'common/parentFolder/type';
|
||||
import { AppTypeEnum } from 'core/app/constants';
|
||||
import { FlowNodeTemplateType, StoreNodeItemType } from './node';
|
||||
|
||||
export type FlowNodeCommonType = {
|
||||
flowNodeType: FlowNodeTypeEnum; // render node card
|
||||
export type WorkflowTemplateBasicType = {
|
||||
nodes: StoreNodeItemType[];
|
||||
edges: StoreEdgeItemType[];
|
||||
chatConfigs?: AppChatConfigType;
|
||||
};
|
||||
export type WorkflowTemplateType = {
|
||||
id: string;
|
||||
parentId?: string;
|
||||
isFolder?: boolean;
|
||||
|
||||
avatar?: string;
|
||||
name: string;
|
||||
intro?: string; // template list intro
|
||||
showStatus?: boolean; // chatting response step status
|
||||
avatar: string;
|
||||
intro?: string;
|
||||
author?: string;
|
||||
version: string;
|
||||
|
||||
// data
|
||||
inputs: FlowNodeInputItemType[];
|
||||
outputs: FlowNodeOutputItemType[];
|
||||
showStatus?: boolean;
|
||||
weight?: number;
|
||||
|
||||
// plugin data
|
||||
pluginId?: string;
|
||||
pluginType?: AppTypeEnum;
|
||||
// parentId: ParentIdType;
|
||||
workflow: WorkflowTemplateBasicType;
|
||||
};
|
||||
|
||||
export type FlowNodeTemplateType = FlowNodeCommonType & {
|
||||
id: string; // node id, unique
|
||||
templateType: `${FlowNodeTemplateTypeEnum}`;
|
||||
|
||||
// show handle
|
||||
sourceHandle?: {
|
||||
left: boolean;
|
||||
right: boolean;
|
||||
top: boolean;
|
||||
bottom: boolean;
|
||||
};
|
||||
targetHandle?: {
|
||||
left: boolean;
|
||||
right: boolean;
|
||||
top: boolean;
|
||||
bottom: boolean;
|
||||
};
|
||||
|
||||
// info
|
||||
isTool?: boolean; // can be connected by tool
|
||||
|
||||
// action
|
||||
forbidDelete?: boolean; // forbid delete
|
||||
unique?: boolean;
|
||||
// template market
|
||||
export type TemplateMarketItemType = WorkflowTemplateType & {
|
||||
tags?: { id: string; label: string }[];
|
||||
};
|
||||
export type FlowNodeItemType = FlowNodeTemplateType & {
|
||||
nodeId: string;
|
||||
isError?: boolean;
|
||||
debugResult?: {
|
||||
status: 'running' | 'success' | 'skipped' | 'failed';
|
||||
message?: string;
|
||||
showResult?: boolean; // show and hide result modal
|
||||
response?: ChatHistoryItemResType;
|
||||
isExpired?: boolean;
|
||||
};
|
||||
};
|
||||
export type nodeTemplateListType = {
|
||||
type: `${FlowNodeTemplateTypeEnum}`;
|
||||
label: string;
|
||||
list: FlowNodeTemplateType[];
|
||||
}[];
|
||||
// system plugin
|
||||
export type SystemPluginTemplateItemType = WorkflowTemplateType & {
|
||||
templateType: FlowNodeTemplateTypeEnum;
|
||||
isTool?: boolean;
|
||||
|
||||
// store node type
|
||||
export type StoreNodeItemType = FlowNodeCommonType & {
|
||||
nodeId: string;
|
||||
position?: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
};
|
||||
originCost: number; // n points/one time
|
||||
currentCost: number;
|
||||
|
||||
/* connection type */
|
||||
export type NodeTargetNodeItemType = {
|
||||
nodeId: string;
|
||||
sourceHandle: string;
|
||||
targetHandle: string;
|
||||
};
|
||||
export type NodeSourceNodeItemType = {
|
||||
nodeId: string;
|
||||
};
|
||||
|
||||
/* --------------- function type -------------------- */
|
||||
export type SelectAppItemType = {
|
||||
id: string;
|
||||
// name: string;
|
||||
// logo?: string;
|
||||
};
|
||||
|
||||
/* agent */
|
||||
export type ClassifyQuestionAgentItemType = {
|
||||
value: string;
|
||||
key: string;
|
||||
};
|
||||
export type ContextExtractAgentItemType = {
|
||||
valueType: 'string' | 'number' | 'boolean';
|
||||
desc: string;
|
||||
key: string;
|
||||
required: boolean;
|
||||
defaultValue?: string;
|
||||
enum?: string;
|
||||
};
|
||||
|
||||
/* -------------- running module -------------- */
|
||||
|
||||
export type ChatDispatchProps = {
|
||||
res?: NextApiResponse;
|
||||
mode: 'test' | 'chat' | 'debug';
|
||||
teamId: string;
|
||||
tmbId: string;
|
||||
user: UserModelSchema;
|
||||
app: AppDetailType | AppSchema;
|
||||
chatId?: string;
|
||||
responseChatItemId?: string;
|
||||
histories: ChatItemType[];
|
||||
variables: Record<string, any>; // global variable
|
||||
query: UserChatItemValueItemType[]; // trigger query
|
||||
stream: boolean;
|
||||
detail: boolean; // response detail
|
||||
maxRunTimes: number;
|
||||
isToolCall?: boolean;
|
||||
};
|
||||
|
||||
export type ModuleDispatchProps<T> = ChatDispatchProps & {
|
||||
node: RuntimeNodeItemType;
|
||||
runtimeNodes: RuntimeNodeItemType[];
|
||||
runtimeEdges: RuntimeEdgeItemType[];
|
||||
params: T;
|
||||
workflow: WorkflowTemplateBasicType;
|
||||
};
|
||||
|
64
packages/global/core/workflow/type/io.d.ts
vendored
64
packages/global/core/workflow/type/io.d.ts
vendored
@@ -1,9 +1,43 @@
|
||||
import { LLMModelTypeEnum } from '../../ai/constants';
|
||||
import { WorkflowIOValueTypeEnum, NodeInputKeyEnum, NodeOutputKeyEnum } from '../constants';
|
||||
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum } from '../node/constant';
|
||||
import { EditInputFieldMapType, EditNodeFieldType, EditOutputFieldMapType } from '../node/type';
|
||||
|
||||
export type FlowNodeInputItemType = {
|
||||
// Dynamic input field configuration
|
||||
export type CustomFieldConfigType = {
|
||||
// selectInputTypeList: FlowNodeInputTypeEnum[]; // 可以选哪些输入类型, 只有1个话,则默认选择
|
||||
|
||||
// reference
|
||||
selectValueTypeList?: WorkflowIOValueTypeEnum[]; // 可以选哪个数据类型, 只有1个的话,则默认选择
|
||||
|
||||
// showIsToolParam?: boolean; // 是否作为工具参数
|
||||
|
||||
// showRequired?: boolean;
|
||||
// defaultRequired?: boolean;
|
||||
|
||||
showDefaultValue?: boolean;
|
||||
showDescription?: boolean;
|
||||
};
|
||||
export type InputComponentPropsType = {
|
||||
referencePlaceholder?: string;
|
||||
placeholder?: string; // input,textarea
|
||||
maxLength?: number; // input,textarea
|
||||
|
||||
list?: { label: string; value: string }[]; // select
|
||||
|
||||
markList?: { label: string; value: number }[]; // slider
|
||||
step?: number; // slider
|
||||
max?: number; // slider, number input
|
||||
min?: number; // slider, number input
|
||||
|
||||
defaultValue?: string;
|
||||
|
||||
llmModelType?: `${LLMModelTypeEnum}`;
|
||||
|
||||
// dynamic input
|
||||
customInputConfig?: CustomFieldConfigType;
|
||||
};
|
||||
|
||||
export type FlowNodeInputItemType = InputComponentPropsType & {
|
||||
selectedTypeIndex?: number;
|
||||
renderTypeList: FlowNodeInputTypeEnum[]; // Node Type. Decide on a render style
|
||||
|
||||
@@ -16,29 +50,8 @@ export type FlowNodeInputItemType = {
|
||||
required?: boolean;
|
||||
toolDescription?: string; // If this field is not empty, it is entered as a tool
|
||||
|
||||
maxLength?: number; // input,textarea
|
||||
|
||||
// edit
|
||||
canEdit?: boolean;
|
||||
|
||||
// render components params
|
||||
referencePlaceholder?: string;
|
||||
placeholder?: string; // input,textarea
|
||||
|
||||
list?: { label: string; value: any }[]; // select
|
||||
|
||||
markList?: { label: string; value: any }[]; // slider
|
||||
step?: number; // slider
|
||||
max?: number; // slider, number input
|
||||
min?: number; // slider, number input
|
||||
|
||||
defaultValue?: string;
|
||||
|
||||
// dynamic input
|
||||
editField?: EditNodeFieldType['editField'];
|
||||
dynamicParamDefaultValue?: EditNodeFieldType['dynamicParamDefaultValue'];
|
||||
|
||||
llmModelType?: `${LLMModelTypeEnum}`;
|
||||
canEdit?: boolean; // dynamic inputs
|
||||
};
|
||||
|
||||
export type FlowNodeOutputItemType = {
|
||||
@@ -54,8 +67,7 @@ export type FlowNodeOutputItemType = {
|
||||
required?: boolean;
|
||||
|
||||
// component params
|
||||
canEdit?: boolean;
|
||||
editField?: EditOutputFieldMapType; // 添加
|
||||
customFieldConfig?: CustomFieldConfigType;
|
||||
};
|
||||
|
||||
export type ReferenceValueProps = [string, string | undefined];
|
||||
|
111
packages/global/core/workflow/type/node.d.ts
vendored
Normal file
111
packages/global/core/workflow/type/node.d.ts
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
import { FlowNodeTypeEnum } from '../node/constant';
|
||||
import {
|
||||
WorkflowIOValueTypeEnum,
|
||||
NodeOutputKeyEnum,
|
||||
FlowNodeTemplateTypeEnum,
|
||||
VariableInputEnum
|
||||
} from '../constants';
|
||||
import { DispatchNodeResponseKeyEnum } from '../runtime/constants';
|
||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from './io.d';
|
||||
import { UserModelSchema } from '../../../support/user/type';
|
||||
import {
|
||||
ChatHistoryItemResType,
|
||||
ChatItemType,
|
||||
ChatItemValueItemType,
|
||||
ToolRunResponseItemType,
|
||||
UserChatItemValueItemType
|
||||
} from '../../chat/type';
|
||||
import { ChatNodeUsageType } from '../../../support/wallet/bill/type';
|
||||
import { RuntimeNodeItemType } from '../runtime/type';
|
||||
import { PluginTypeEnum } from '../../plugin/constants';
|
||||
import { RuntimeEdgeItemType, StoreEdgeItemType } from './edge';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { AppDetailType, AppSchema } from '../../app/type';
|
||||
import { ParentIdType } from 'common/parentFolder/type';
|
||||
import { AppTypeEnum } from 'core/app/constants';
|
||||
|
||||
export type FlowNodeCommonType = {
|
||||
flowNodeType: FlowNodeTypeEnum; // render node card
|
||||
abandon?: boolean; // abandon node
|
||||
|
||||
avatar?: string;
|
||||
name: string;
|
||||
intro?: string; // template list intro
|
||||
showStatus?: boolean; // chatting response step status
|
||||
version: string;
|
||||
|
||||
// data
|
||||
inputs: FlowNodeInputItemType[];
|
||||
outputs: FlowNodeOutputItemType[];
|
||||
|
||||
// plugin data
|
||||
pluginId?: string;
|
||||
isFolder?: boolean;
|
||||
// pluginType?: AppTypeEnum;
|
||||
};
|
||||
|
||||
type HandleType = {
|
||||
left: boolean;
|
||||
right: boolean;
|
||||
top: boolean;
|
||||
bottom: boolean;
|
||||
};
|
||||
// system template
|
||||
export type FlowNodeTemplateType = FlowNodeCommonType & {
|
||||
id: string; // node id, unique
|
||||
templateType: FlowNodeTemplateTypeEnum;
|
||||
|
||||
// show handle
|
||||
sourceHandle?: HandleType;
|
||||
targetHandle?: HandleType;
|
||||
|
||||
// info
|
||||
isTool?: boolean; // can be connected by tool
|
||||
|
||||
// action
|
||||
forbidDelete?: boolean; // forbid delete
|
||||
unique?: boolean;
|
||||
};
|
||||
|
||||
export type NodeTemplateListItemType = {
|
||||
id: string; // 系统节点-系统节点的 id, 系统插件-插件的 id,团队应用的 id
|
||||
flowNodeType: FlowNodeTypeEnum; // render node card
|
||||
parentId?: string;
|
||||
isFolder?: boolean;
|
||||
templateType: FlowNodeTemplateTypeEnum;
|
||||
avatar?: string;
|
||||
name: string;
|
||||
intro?: string; // template list intro
|
||||
isTool?: boolean;
|
||||
author?: string;
|
||||
unique?: boolean; // 唯一的
|
||||
};
|
||||
|
||||
export type NodeTemplateListType = {
|
||||
type: FlowNodeTemplateTypeEnum;
|
||||
label: string;
|
||||
list: NodeTemplateListItemType[];
|
||||
}[];
|
||||
|
||||
// react flow node type
|
||||
export type FlowNodeItemType = FlowNodeTemplateType & {
|
||||
nodeId: string;
|
||||
isError?: boolean;
|
||||
debugResult?: {
|
||||
status: 'running' | 'success' | 'skipped' | 'failed';
|
||||
message?: string;
|
||||
showResult?: boolean; // show and hide result modal
|
||||
response?: ChatHistoryItemResType;
|
||||
isExpired?: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
// store node type
|
||||
export type StoreNodeItemType = FlowNodeCommonType & {
|
||||
nodeId: string;
|
||||
// isEntry: boolean;
|
||||
position?: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
};
|
@@ -6,7 +6,7 @@ import {
|
||||
variableMap
|
||||
} from './constants';
|
||||
import { FlowNodeInputItemType, FlowNodeOutputItemType } from './type/io.d';
|
||||
import { StoreNodeItemType } from './type';
|
||||
import { StoreNodeItemType } from './type/node';
|
||||
import type {
|
||||
VariableItemType,
|
||||
AppTTSConfigType,
|
||||
|
5
packages/global/support/permission/type.d.ts
vendored
5
packages/global/support/permission/type.d.ts
vendored
@@ -37,3 +37,8 @@ export type ResourcePermissionType = {
|
||||
export type ResourcePerWithTmbWithUser = Omit<ResourcePermissionType, 'tmbId'> & {
|
||||
tmbId: TeamMemberWithUserSchema;
|
||||
};
|
||||
|
||||
export type PermissionSchemaType = {
|
||||
defaultPermission: PermissionValueType;
|
||||
inheritPermission: boolean;
|
||||
};
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { TeamMemberRoleEnum } from '../user/team/constant';
|
||||
import { PermissionTypeEnum } from './constant';
|
||||
import { PermissionValueType } from './type';
|
||||
import { NullPermission, PermissionTypeEnum } from './constant';
|
||||
import { Permission } from './controller';
|
||||
|
||||
/* team public source, or owner source in team */
|
||||
@@ -28,3 +28,17 @@ export function mongoOwnerPermission({ teamId, tmbId }: { teamId: string; tmbId:
|
||||
tmbId
|
||||
};
|
||||
}
|
||||
|
||||
// return permission-related schema to define the schema of resources
|
||||
export function getPermissionSchema(defaultPermission: PermissionValueType = NullPermission) {
|
||||
return {
|
||||
defaultPermission: {
|
||||
type: Number,
|
||||
default: defaultPermission
|
||||
},
|
||||
inheritPermission: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
};
|
||||
}
|
||||
|
2
packages/global/support/wallet/bill/api.d.ts
vendored
2
packages/global/support/wallet/bill/api.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
import { BillTypeEnum } from './constants';
|
||||
|
||||
export type CreateBillProps = {
|
||||
type: `${BillTypeEnum}`;
|
||||
type: BillTypeEnum;
|
||||
|
||||
// balance
|
||||
balance?: number; // read
|
||||
|
@@ -9,7 +9,7 @@ export type BillSchemaType = {
|
||||
createTime: Date;
|
||||
orderId: string;
|
||||
status: 'SUCCESS' | 'REFUND' | 'NOTPAY' | 'CLOSED';
|
||||
type: `${BillTypeEnum}`;
|
||||
type: BillTypeEnum;
|
||||
price: number;
|
||||
hasInvoice: boolean;
|
||||
metadata: {
|
||||
|
@@ -21,6 +21,6 @@ export type CreateUsageProps = {
|
||||
appId?: string;
|
||||
pluginId?: string;
|
||||
totalPoints: number;
|
||||
source: `${UsageSourceEnum}`;
|
||||
source: UsageSourceEnum;
|
||||
list: UsageListItemType[];
|
||||
};
|
||||
|
Reference in New Issue
Block a user