feature: System plugin (#5131)

* feat: system Tool (#4959)

* feat: independent system tool

* chore: use ToolNode instead of PluginModule

* chore: tools

* chore: tools templateDir

* refactor: templates

* feat: flush code

* chore: update template

* refactor: migrate delay

* feat: worker pool

* chore: Dockerfile

* docs:  add tools.template.json

* feat: auto flush system tools

* fix: ts error

* chore: create new pool temporarily

* chore: system tool migration

* chore: migration

* fix: fix pnpm-workspace.yaml

* chore: update pnpm-lock.yaml to integrate tool

* chore(systemTool): chore

* chore: add system plugin

* chore(deps): update @fastgpt-sdk/plugin

* fix: type error

* chore: remove plugin package

* chore: move pro plugins code to open source

* feat: support system tool config input

* fix: type error

* perf: i18n

* fix: cr

* chore: update sdk

* feat: system plugin cache

* update mcp server (#5076)

* update mcp server

* fix: action

* fix: dockerfile

* fix: dockerfile

* fix: dockerfile

* fix: dockerfile

* fix: dockerfile

* fix: dockerfile

* feat: system Tool (#4959)

* feat: independent system tool

* chore: use ToolNode instead of PluginModule

* chore: tools

* chore: tools templateDir

* refactor: templates

* feat: flush code

* chore: update template

* refactor: migrate delay

* feat: worker pool

* chore: Dockerfile

* docs:  add tools.template.json

* feat: auto flush system tools

* fix: ts error

* chore: create new pool temporarily

* chore: system tool migration

* chore: migration

* fix: fix pnpm-workspace.yaml

* chore: update pnpm-lock.yaml to integrate tool

* chore(systemTool): chore

* chore: add system plugin

* chore(deps): update @fastgpt-sdk/plugin

* fix: type error

* chore: remove plugin package

* chore: move pro plugins code to open source

* feat: support system tool config input

* fix: type error

* perf: i18n

* fix: cr

* chore: update sdk

* feat: system plugin cache

* perf: run tool

* update package

* perf: config key

* fix: tool ini

* tool config params

* perf: workflow type

* rename tools to  agent

* version list

* perf: tool error

* config secret ux

* perf: config secret ux

* fix: tool config field

* add course to secret input

* feat: support inputConfig switch (#5099)

* feat: support inputConfig switch

* deps: update @fastgpt-sdk/plugin

* chore: update workflows

* fix: inputType

* fix: secret

* add default value to node

* update i18n

* eslint

* add precision to number input

* feat: add number input and select

* perf: number ux

* fix: code

* Proxies image requests to plugin service (#5111)

* Proxies image requests to plugin service

Adds a rewrite rule and API endpoint to proxy image requests
to the plugin service. This allows the app to fetch images from
the plugin's tools directory.

It also adds the plugin base URL to the service's constants, so that
it can use the plugin URL when proxying requests.

* fix: update FastGPTPluginUrl to remove unnecessary API path

* feat: update image proxy destination and add plugin image handler

* Adapt plugin id

* replace avatar

* remove rewrite

* fix: plugin avatar

* update system tool doc

* feat: system tool type

* yml sh

* yml sh

* update doc

* fix: simple app tool select

* fix: switch ui

* update pacakge

* Yamljs (#5129)

* update docker-compose configuration: bump fastgpt and fastgpt-plugin images, change minio host to service name, and adjust service dependencies

* refactor: comment out port exposure in docker-compose configuration

* update: uncomment port exposure in docker-compose configuration

* update: change MINIO_HOST to use specific IP address in docker configuration

* update: modify fastgpt-plugin image version in docker configuration

* update readme

* doc

* remove

---------

Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
Co-authored-by: Theresa <63280168+sd0ric4@users.noreply.github.com>
This commit is contained in:
Archer
2025-07-02 18:15:00 +08:00
committed by GitHub
parent 0ead423960
commit 33d40fd077
241 changed files with 2507 additions and 12443 deletions

View File

@@ -10,6 +10,7 @@ export const getErrText = (err: any, def = ''): any => {
err?.response?.data?.msg ||
err?.response?.msg ||
err?.msg ||
err?.error ||
def;
// msg && console.log('error =>', msg);
return replaceSensitiveText(msg);

View File

@@ -0,0 +1,29 @@
export type I18nStringType = {
'zh-CN'?: string;
'zh-Hant'?: string;
en: string;
};
export enum LangEnum {
'zh_CN' = 'zh-CN',
'zh_Hant' = 'zh-Hant',
'en' = 'en'
}
export type localeType = `${LangEnum}`;
export const LocaleList = ['en', 'zh-CN', 'zh-Hant'] as const;
export const langMap = {
[LangEnum.en]: {
label: 'English(US)',
avatar: 'common/language/America'
},
[LangEnum.zh_CN]: {
label: '简体中文',
avatar: 'common/language/China'
},
[LangEnum.zh_Hant]: {
label: '繁体中文',
avatar: 'common/language/China'
}
};

View File

@@ -0,0 +1,6 @@
import type { I18nStringType, localeType } from './type';
export const parseI18nString = (str: I18nStringType | string = '', lang: localeType = 'en') => {
if (!str || typeof str === 'string') return str;
return str[lang] ?? str['en'];
};

View File

@@ -8,7 +8,7 @@ import { WorkflowIOValueTypeEnum } from '../../workflow/constants';
import { PluginInputModule } from '../../workflow/template/system/pluginInput';
import { PluginOutputModule } from '../../workflow/template/system/pluginOutput';
import { HttpNode468 } from '../../workflow/template/system/http468';
import { type HttpParamAndHeaderItemType } from '../../workflow/api';
import { type HttpParamAndHeaderItemType } from '../../workflow/type/io';
import { type StoreNodeItemType } from '../../workflow/type/node';
import { HttpImgUrl } from '../../../common/file/image/constants';
import SwaggerParser from '@apidevtools/swagger-parser';

View File

@@ -3,13 +3,13 @@ import {
NodeOutputKeyEnum,
WorkflowIOValueTypeEnum
} from '../../workflow/constants';
import { i18nT } from '../../../../web/i18n/utils';
import {
FlowNodeInputTypeEnum,
FlowNodeOutputTypeEnum,
FlowNodeTypeEnum
} from '../../workflow/node/constant';
import { type McpToolConfigType } from '../type';
import { i18nT } from '../../../../web/i18n/utils';
import { type RuntimeNodeItemType } from '../../workflow/runtime/type';
import { type StoreSecretValueType } from '../../../common/secret/type';
import { jsonSchema2NodeInput } from '../jsonschema';

View File

@@ -0,0 +1,7 @@
export enum PluginSourceEnum {
personal = 'personal', // this is a app.
systemTool = 'systemTool', // FastGPT-plugin tools, pure code.
commercial = 'commercial', // configured in Pro, with associatedPluginId. Specially, commercial-dalle3 is a systemTool
// @deprecated
community = 'community' // this is deprecated, will be replaced by systemTool
}

View File

@@ -0,0 +1,63 @@
import type { StoreEdgeItemType } from 'core/workflow/type/edge';
import { ModuleTemplateTypeEnum } from '../../workflow/constants';
import type { StoreNodeItemType } from '../../workflow/type/node';
import { MethodType } from './controller';
import type { FlowNodeTemplateType } from '../../workflow/type/node';
import type { WorkflowTemplateType } from '../../workflow/type';
import type { FlowNodeInputItemType, FlowNodeOutputItemType } from '../../workflow/type/io';
import type { ParentIdType } from 'common/parentFolder/type';
export type PluginRuntimeType = {
id: string;
teamId?: string;
tmbId?: string;
name: string;
avatar: string;
showStatus?: boolean;
isTool?: boolean;
nodes: StoreNodeItemType[];
edges: StoreEdgeItemType[];
currentCost?: number;
hasTokenFee?: boolean;
};
// system plugin
export type SystemPluginTemplateItemType = WorkflowTemplateType & {
parentId?: ParentIdType;
isFolder?: boolean;
templateType: string;
// FastGPT-plugin tool
inputs?: FlowNodeInputItemType[];
outputs?: FlowNodeOutputItemType[];
versionList?: {
value: string;
description?: string;
}[];
// Admin workflow tool
associatedPluginId?: string;
userGuide?: string;
// commercial plugin config
originCost?: number; // n points/one time
currentCost?: number;
hasTokenFee?: boolean;
pluginOrder?: number;
isActive?: boolean;
isOfficial?: boolean;
// Admin config
inputList?: FlowNodeInputItemType['inputList'];
hasSystemSecret?: boolean;
};
export type SystemPluginTemplateListItemType = Omit<
SystemPluginTemplateItemType,
'name' | 'intro'
> & {
name: string;
intro: string;
};

View File

@@ -0,0 +1,18 @@
import { i18nT } from '../../../../web/i18n/utils';
export enum SystemToolInputTypeEnum {
system = 'system',
team = 'team',
manual = 'manual'
}
export const SystemToolInputTypeMap = {
[SystemToolInputTypeEnum.system]: {
text: i18nT('common:System')
},
[SystemToolInputTypeEnum.team]: {
text: i18nT('common:Team')
},
[SystemToolInputTypeEnum.manual]: {
text: i18nT('common:Manual')
}
};

View File

@@ -6,7 +6,7 @@ import type {
VariableInputEnum,
WorkflowIOValueTypeEnum
} from '../workflow/constants';
import type { SelectedDatasetType } from '../workflow/api';
import type { SelectedDatasetType } from '../workflow/type/io';
import type { DatasetSearchModeEnum } from '../dataset/constants';
import { TeamTagSchema as TeamTagsSchemaType } from '@fastgpt/global/support/user/team/type.d';
import type { StoreEdgeItemType } from '../workflow/type/edge';

View File

@@ -53,7 +53,7 @@ export const appWorkflow2Form = ({
nodes.forEach((node) => {
if (
node.flowNodeType === FlowNodeTypeEnum.chatNode ||
node.flowNodeType === FlowNodeTypeEnum.tools
node.flowNodeType === FlowNodeTypeEnum.agent
) {
defaultAppForm.aiSettings.model = findInputValueByKey(node.inputs, NodeInputKeyEnum.aiModel);
defaultAppForm.aiSettings.systemPrompt = findInputValueByKey(

View File

@@ -94,7 +94,7 @@ export const filterPublicNodeResponseData = ({
const publicNodeMap: Record<string, any> = {
[FlowNodeTypeEnum.pluginModule]: true,
[FlowNodeTypeEnum.datasetSearchNode]: true,
[FlowNodeTypeEnum.tools]: true,
[FlowNodeTypeEnum.agent]: true,
[FlowNodeTypeEnum.pluginOutput]: true
};

View File

@@ -1,25 +0,0 @@
export enum PluginTypeEnum {
folder = 'folder',
custom = 'custom',
http = 'http'
}
export const pluginTypeMap = {
[PluginTypeEnum.folder]: {
label: '文件夹',
icon: 'file/fill/folder'
},
[PluginTypeEnum.custom]: {
label: '自定义',
icon: 'common/custom'
},
[PluginTypeEnum.http]: {
label: 'HTTP',
icon: 'common/http'
}
};
export enum PluginSourceEnum {
personal = 'personal',
community = 'community',
commercial = 'commercial'
}

View File

@@ -1,42 +0,0 @@
import type { StoreEdgeItemType } from 'core/workflow/type/edge';
import type { StoreNodeItemType } from '../workflow/type/node';
import type { PluginTypeEnum } from './constants';
import { HttpAuthMethodType } from '../app/httpPlugin/type';
export type CreateOnePluginParams = {
name: string;
avatar: string;
intro: string;
modules: StoreNodeItemType[];
parentId: string | null;
type: `${PluginTypeEnum}`;
metadata?: {
apiSchemaStr?: string;
customHeaders?: string;
};
};
export type UpdatePluginParams = {
id: string;
parentId?: string | null;
name?: string;
avatar?: string;
intro?: string;
modules?: StoreNodeItemType[];
edges?: StoreEdgeItemType[];
metadata?: {
apiSchemaStr?: string;
customHeaders?: string;
};
};
export type PluginListItemType = {
_id: string;
parentId: string;
type: `${PluginTypeEnum}`;
name: string;
avatar: string;
intro: string;
metadata?: {
apiSchemaStr?: string;
customHeaders?: string;
};
};

View File

@@ -1,54 +0,0 @@
import type { StoreEdgeItemType } from 'core/workflow/type/edge';
import { ModuleTemplateTypeEnum } from '../workflow/constants';
import type { StoreNodeItemType } from '../workflow/type/node';
import type { PluginSourceEnum, PluginTypeEnum } from './constants';
import { MethodType } from './controller';
import type { FlowNodeTemplateType } from '../workflow/type/node';
export type PluginItemSchema = {
_id: string;
userId: string;
teamId: string;
tmbId: string;
name: string;
avatar: string;
intro: string;
updateTime: Date;
modules: StoreNodeItemType[];
edges: StoreEdgeItemType[];
parentId: string;
type: `${PluginTypeEnum}`;
metadata?: {
pluginUid?: string;
apiSchemaStr?: string;
customHeaders?: string;
};
version?: 'v1' | 'v2';
nodeVersion?: string;
inited?: boolean;
};
/* plugin template */
export type PluginTemplateType = PluginRuntimeType & {
author?: string;
id: string;
source: PluginSourceEnum;
templateType: FlowNodeTemplateType['templateType'];
intro: string;
version: string;
};
export type PluginRuntimeType = {
id: string;
teamId?: string;
tmbId?: string;
name: string;
avatar: string;
showStatus?: boolean;
isTool?: boolean;
nodes: StoreNodeItemType[];
edges: StoreEdgeItemType[];
currentCost?: number;
hasTokenFee?: boolean;
};

View File

@@ -1,27 +0,0 @@
import type { EmbeddingModelItemType } from '../ai/model.d';
import { NodeInputKeyEnum } from './constants';
export type SelectedDatasetType = {
datasetId: string;
avatar: string;
name: string;
vectorModel: EmbeddingModelItemType;
}[];
export type HttpBodyType<T = Record<string, any>> = {
// [NodeInputKeyEnum.addInputParam]: Record<string, any>;
} & T;
export type HttpQueryType = {
appId: string;
chatId?: string;
responseChatItemId?: string;
variables: Record<string, any>;
[key: string]: any;
};
/* http node */
export type HttpParamAndHeaderItemType = {
key: string;
type: string;
value: string;
};

View File

@@ -5,14 +5,23 @@ export enum FlowNodeTemplateTypeEnum {
systemInput = 'systemInput',
ai = 'ai',
function = 'function',
tools = 'tools',
interactive = 'interactive',
// System tool type
tools = 'tools',
search = 'search',
multimodal = 'multimodal',
communication = 'communication',
finance = 'finance',
design = 'design',
productivity = 'productivity',
news = 'news',
entertainment = 'entertainment',
social = 'social',
scientific = 'scientific',
other = 'other',
// Team app type
teamApp = 'teamApp'
}
@@ -143,6 +152,7 @@ export enum NodeInputKeyEnum {
addInputParam = 'system_addInputParam',
forbidStream = 'system_forbid_stream',
headerSecret = 'system_header_secret',
systemInputConfig = 'system_input_config',
// history
historyMaxAmount = 'maxContext',
@@ -263,6 +273,7 @@ export enum NodeOutputKeyEnum {
text = 'system_text',
addOutputParam = 'system_addOutputParam',
rawResponse = 'system_rawResponse',
systemError = 'system_error',
// start
userFiles = 'userFiles',

View File

@@ -1,5 +1,5 @@
import { WorkflowIOValueTypeEnum } from '../constants';
import { i18nT } from '../../../../web/i18n/utils';
import { WorkflowIOValueTypeEnum } from '../constants';
export enum FlowNodeInputTypeEnum { // render ui
reference = 'reference', // reference to other node output
input = 'input', // one line input
@@ -125,7 +125,7 @@ export enum FlowNodeTypeEnum {
pluginInput = 'pluginInput',
pluginOutput = 'pluginOutput',
queryExtension = 'cfr',
tools = 'tools',
agent = 'tools',
stopTool = 'stopTool',
toolParams = 'toolParams',
lafModule = 'lafModule',

View File

@@ -1,17 +0,0 @@
import { type 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
};
};

View File

@@ -1,7 +1,6 @@
import type { ChatNodeUsageType } from '../../../support/wallet/bill/type';
import type {
ChatItemType,
UserChatItemValueItemType,
ToolRunResponseItemType,
AIChatItemValueItemType
} from '../../chat/type';
@@ -96,15 +95,15 @@ export type RuntimeNodeItemType = {
flowNodeType: StoreNodeItemType['flowNodeType'];
showStatus?: StoreNodeItemType['showStatus'];
isEntry?: boolean;
version?: string;
inputs: FlowNodeInputItemType[];
outputs: FlowNodeOutputItemType[];
pluginId?: string; // workflow id / plugin id
version?: string;
// tool
toolConfig?: NodeToolConfigType;
// Tool
toolConfig?: StoreNodeItemType['toolConfig'];
};
export type RuntimeEdgeItemType = StoreEdgeItemType & {

View File

@@ -1,20 +1,24 @@
import { ChatCompletionRequestMessageRoleEnum } from '../../ai/constants';
import { NodeInputKeyEnum, NodeOutputKeyEnum, WorkflowIOValueTypeEnum } from '../constants';
import { FlowNodeTypeEnum } from '../node/constant';
import { type StoreNodeItemType } from '../type/node';
import { type StoreEdgeItemType } from '../type/edge';
import { type RuntimeEdgeItemType, type RuntimeNodeItemType } from './type';
import { VARIABLE_NODE_ID } from '../constants';
import { isValidReferenceValueFormat } from '../utils';
import { type FlowNodeOutputItemType, type ReferenceValueType } from '../type/io';
import { type ChatItemType, type NodeOutputItemType } from '../../../core/chat/type';
import { ChatItemValueTypeEnum, ChatRoleEnum } from '../../../core/chat/constants';
import { replaceVariable, valToStr } from '../../../common/string/tools';
import json5 from 'json5';
import { replaceVariable, valToStr } from '../../../common/string/tools';
import { ChatItemValueTypeEnum, ChatRoleEnum } from '../../../core/chat/constants';
import type { ChatItemType, NodeOutputItemType } from '../../../core/chat/type';
import { ChatCompletionRequestMessageRoleEnum } from '../../ai/constants';
import {
NodeInputKeyEnum,
NodeOutputKeyEnum,
VARIABLE_NODE_ID,
WorkflowIOValueTypeEnum
} from '../constants';
import { FlowNodeTypeEnum } from '../node/constant';
import {
type InteractiveNodeResponseType,
type WorkflowInteractiveResponseType
} from '../template/system/interactive/type';
import type { StoreEdgeItemType } from '../type/edge';
import type { FlowNodeOutputItemType, ReferenceValueType } from '../type/io';
import type { StoreNodeItemType } from '../type/node';
import { isValidReferenceValueFormat } from '../utils';
import type { RuntimeEdgeItemType, RuntimeNodeItemType } from './type';
export const extractDeepestInteractive = (
interactive: WorkflowInteractiveResponseType
@@ -151,7 +155,7 @@ export const valueTypeFormat = (value: any, type?: WorkflowIOValueTypeEnum) => {
return value;
};
/*
/*
Get interaction information (if any) from the last AI message.
What can be done:
1. Get the interactive data
@@ -254,7 +258,8 @@ export const storeNodes2RuntimeNodes = (
inputs: node.inputs,
outputs: node.outputs,
pluginId: node.pluginId,
version: node.version
version: node.version,
toolConfig: node.toolConfig
};
}) || []
);
@@ -268,7 +273,7 @@ export const filterWorkflowEdges = (edges: RuntimeEdgeItemType[]) => {
);
};
/*
/*
1. 输入线分类:普通线和递归线(可以追溯到自身)
2. 起始线全部非 waiting 执行,或递归线全部非 waiting 执行
*/
@@ -279,7 +284,7 @@ export const checkNodeRunStatus = ({
node: RuntimeNodeItemType;
runtimeEdges: RuntimeEdgeItemType[];
}) => {
/*
/*
区分普通连线和递归连线
递归连线:可以通过往上查询 nodes最终追溯到自身
*/
@@ -363,7 +368,7 @@ export const checkNodeRunStatus = ({
return 'wait';
};
/*
/*
Get the value of the reference variable/node output
1. [string,string]
2. [string,string][]

View File

@@ -1,41 +1,41 @@
import { SystemConfigNode } from './system/systemConfig';
import { PluginConfigNode } from './system/pluginConfig';
import { EmptyNode } from './system/emptyNode';
import { WorkflowStart } from './system/workflowStart';
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/index';
import { ContextExtractModule } from './system/contextExtract/index';
import { DatasetConcatModule } from './system/datasetConcat';
import { DatasetSearchModule } from './system/datasetSearch';
import { EmptyNode } from './system/emptyNode';
import { HttpNode468 } from './system/http468';
import { PluginConfigNode } from './system/pluginConfig';
import { SystemConfigNode } from './system/systemConfig';
import { WorkflowStart } from './system/workflowStart';
import { ToolModule } from './system/tools';
import { StopToolNode } from './system/stopTool';
import { AgentNode } from './system/agent';
import { RunAppModule } from './system/abandoned/runApp/index';
import { PluginInputModule } from './system/pluginInput';
import { PluginOutputModule } from './system/pluginOutput';
import { RunPluginModule } from './system/runPlugin';
import { RunAppNode } from './system/runApp';
import { AiQueryExtension } from './system/queryExtension';
import { RunAppNode } from './system/runApp';
import { RunPluginModule } from './system/runPlugin';
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';
import { ReadFilesNode } from './system/readFiles';
import { UserSelectNode } from './system/interactive/userSelect';
import { LoopNode } from './system/loop/loop';
import { LoopStartNode } from './system/loop/loopStart';
import { LoopEndNode } from './system/loop/loopEnd';
import { IfElseNode } from './system/ifElse/index';
import { FormInputNode } from './system/interactive/formInput';
import { ToolParamsNode } from './system/toolParams';
import { UserSelectNode } from './system/interactive/userSelect';
import { LafModule } from './system/laf';
import { LoopNode } from './system/loop/loop';
import { LoopEndNode } from './system/loop/loopEnd';
import { LoopStartNode } from './system/loop/loopStart';
import { ReadFilesNode } from './system/readFiles';
import { RunToolNode } from './system/runTool';
import { RunToolSetNode } from './system/runToolSet';
import { CodeNode } from './system/sandbox';
import { TextEditorNode } from './system/textEditor';
import { ToolParamsNode } from './system/toolParams';
import { VariableUpdateNode } from './system/variableUpdate';
const systemNodes: FlowNodeTemplateType[] = [
AiChatModule,
@@ -45,7 +45,7 @@ const systemNodes: FlowNodeTemplateType[] = [
ClassifyQuestionModule,
ContextExtractModule,
DatasetConcatModule,
ToolModule,
AgentNode,
ToolParamsNode,
StopToolNode,
ReadFilesNode,

View File

@@ -12,15 +12,14 @@ import {
FlowNodeTemplateTypeEnum
} from '../../../../constants';
import { Input_Template_History, Input_Template_UserChatInput } from '../../../input';
import { getHandleConfig } from '../../../utils';
import { i18nT } from '../../../../../../../web/i18n/utils';
export const RunAppModule: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.runApp,
templateType: FlowNodeTemplateTypeEnum.tools,
flowNodeType: FlowNodeTypeEnum.runApp,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/runApp',
name: i18nT('workflow:application_call'),
intro: i18nT('workflow:select_another_application_to_call'),

View File

@@ -3,7 +3,7 @@ import {
FlowNodeOutputTypeEnum,
FlowNodeTypeEnum
} from '../../node/constant';
import { type FlowNodeTemplateType } from '../../type/node.d';
import { type FlowNodeTemplateType } from '../../type/node';
import {
WorkflowIOValueTypeEnum,
NodeOutputKeyEnum,
@@ -18,19 +18,18 @@ import {
} from '../input';
import { chatNodeSystemPromptTip, systemPromptTip } from '../tip';
import { LLMModelTypeEnum } from '../../../ai/constants';
import { getHandleConfig } from '../utils';
import { i18nT } from '../../../../../web/i18n/utils';
import { Input_Template_File_Link } from '../input';
export const ToolModule: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.tools,
flowNodeType: FlowNodeTypeEnum.tools,
export const AgentNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.agent,
flowNodeType: FlowNodeTypeEnum.agent,
templateType: FlowNodeTemplateTypeEnum.ai,
sourceHandle: getHandleConfig(true, true, false, true),
targetHandle: getHandleConfig(true, true, false, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/toolCall',
name: i18nT('workflow:template.tool_call'),
intro: i18nT('workflow:template.tool_call_intro'),
name: i18nT('workflow:template.agent'),
intro: i18nT('workflow:template.agent_intro'),
showStatus: true,
courseUrl: '/docs/guide/dashboard/workflow/tool/',
version: '4.9.2',

View File

@@ -19,7 +19,6 @@ import {
Input_Template_UserChatInput,
Input_Template_File_Link
} from '../../input';
import { getHandleConfig } from '../../utils';
import { i18nT } from '../../../../../../web/i18n/utils';
export const AiChatQuoteRole = {
@@ -46,8 +45,8 @@ export const AiChatModule: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.chatNode,
templateType: FlowNodeTemplateTypeEnum.ai,
flowNodeType: FlowNodeTypeEnum.chatNode,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/aiChat',
name: i18nT('workflow:template.ai_chat'),
intro: i18nT('workflow:template.ai_chat_intro'),

View File

@@ -5,15 +5,14 @@ import {
NodeInputKeyEnum,
FlowNodeTemplateTypeEnum
} from '../../constants';
import { getHandleConfig } from '../utils';
import { i18nT } from '../../../../../web/i18n/utils';
export const AssignedAnswerModule: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.answerNode,
templateType: FlowNodeTemplateTypeEnum.tools,
flowNodeType: FlowNodeTypeEnum.answerNode,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/reply',
name: i18nT('workflow:assigned_reply'),
intro: i18nT('workflow:intro_assigned_reply'),

View File

@@ -17,15 +17,14 @@ import {
} from '../../input';
import { Input_Template_System_Prompt } from '../../input';
import { LLMModelTypeEnum } from '../../../../ai/constants';
import { getHandleConfig } from '../../utils';
import { i18nT } from '../../../../../../web/i18n/utils';
export const ClassifyQuestionModule: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.classifyQuestion,
templateType: FlowNodeTemplateTypeEnum.ai,
flowNodeType: FlowNodeTypeEnum.classifyQuestion,
sourceHandle: getHandleConfig(false, false, false, false),
targetHandle: getHandleConfig(true, false, true, true),
showSourceHandle: false,
showTargetHandle: true,
avatar: 'core/workflow/template/questionClassify',
name: i18nT('workflow:question_classification'),
intro: i18nT('workflow:intro_question_classification'),

View File

@@ -5,14 +5,13 @@ import {
NodeInputKeyEnum,
WorkflowIOValueTypeEnum
} from '../../constants';
import { getHandleConfig } from '../utils';
export const CommentNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.comment,
templateType: FlowNodeTemplateTypeEnum.systemInput,
flowNodeType: FlowNodeTypeEnum.comment,
sourceHandle: getHandleConfig(false, false, false, false),
targetHandle: getHandleConfig(false, false, false, false),
showSourceHandle: false,
showTargetHandle: false,
avatar: '',
name: '',
intro: '',

View File

@@ -12,15 +12,14 @@ import {
} from '../../../constants';
import { Input_Template_SelectAIModel, Input_Template_History } from '../../input';
import { LLMModelTypeEnum } from '../../../../ai/constants';
import { getHandleConfig } from '../../utils';
import { i18nT } from '../../../../../../web/i18n/utils';
export const ContextExtractModule: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.contentExtract,
templateType: FlowNodeTemplateTypeEnum.ai,
flowNodeType: FlowNodeTypeEnum.contentExtract,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/extractJson',
name: i18nT('workflow:text_content_extraction'),
intro: i18nT('workflow:intro_text_content_extraction'),

View File

@@ -5,15 +5,14 @@ import {
FlowNodeTemplateTypeEnum,
NodeInputKeyEnum
} from '../../constants';
import { getHandleConfig } from '../utils';
import { i18nT } from '../../../../../web/i18n/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),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/customFeedback',
name: i18nT('workflow:custom_feedback'),
intro: i18nT('workflow:intro_custom_feedback'),

View File

@@ -12,7 +12,6 @@ import {
FlowNodeTemplateTypeEnum
} from '../../constants';
import { getNanoid } from '../../../../common/string/tools';
import { getHandleConfig } from '../utils';
import { type FlowNodeInputItemType } from '../../type/io.d';
import { i18nT } from '../../../../../web/i18n/utils';
@@ -35,8 +34,8 @@ export const DatasetConcatModule: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.datasetConcatNode,
flowNodeType: FlowNodeTypeEnum.datasetConcatNode,
templateType: FlowNodeTemplateTypeEnum.other,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/datasetConcat',
name: i18nT('workflow:knowledge_base_search_merge'),
intro: i18nT('workflow:intro_knowledge_base_search_merge'),

View File

@@ -14,7 +14,6 @@ import {
} from '../../constants';
import { Input_Template_UserChatInput } from '../input';
import { DatasetSearchModeEnum } from '../../../dataset/constants';
import { getHandleConfig } from '../utils';
import { i18nT } from '../../../../../web/i18n/utils';
export const Dataset_SEARCH_DESC = i18nT('workflow:template.dataset_search_intro');
@@ -23,8 +22,8 @@ export const DatasetSearchModule: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.datasetSearchNode,
templateType: FlowNodeTemplateTypeEnum.ai,
flowNodeType: FlowNodeTypeEnum.datasetSearchNode,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/datasetSearch',
name: i18nT('workflow:template.dataset_search'),
intro: Dataset_SEARCH_DESC,

View File

@@ -1,14 +1,13 @@
import { FlowNodeTypeEnum } from '../../node/constant';
import { type FlowNodeTemplateType } from '../../type/node';
import { FlowNodeTemplateTypeEnum } from '../../constants';
import { getHandleConfig } from '../utils';
export const EmptyNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.emptyNode,
templateType: FlowNodeTemplateTypeEnum.systemInput,
flowNodeType: FlowNodeTypeEnum.emptyNode,
sourceHandle: getHandleConfig(false, false, false, false),
targetHandle: getHandleConfig(false, false, false, false),
showSourceHandle: false,
showTargetHandle: false,
avatar: '',
name: '',
intro: '',

View File

@@ -13,15 +13,14 @@ import {
} from '../../constants';
import { Input_Template_DynamicInput } from '../input';
import { Output_Template_AddOutput } from '../output';
import { getHandleConfig } from '../utils';
import { i18nT } from '../../../../../web/i18n/utils';
export const HttpNode468: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.httpRequest468,
templateType: FlowNodeTemplateTypeEnum.tools,
flowNodeType: FlowNodeTypeEnum.httpRequest468,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/httpRequest',
name: i18nT('workflow:http_request'),
intro: i18nT('workflow:intro_http_request'),

View File

@@ -11,14 +11,13 @@ import {
FlowNodeTypeEnum
} from '../../../node/constant';
import { type FlowNodeTemplateType } from '../../../type/node';
import { getHandleConfig } from '../../utils';
export const IfElseNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.ifElseNode,
templateType: FlowNodeTemplateTypeEnum.tools,
flowNodeType: FlowNodeTypeEnum.ifElseNode,
sourceHandle: getHandleConfig(false, false, false, false),
targetHandle: getHandleConfig(true, false, true, true),
showSourceHandle: false,
showTargetHandle: true,
avatar: 'core/workflow/template/ifelse',
name: i18nT('workflow:condition_checker'),
intro: i18nT('workflow:execute_different_branches_based_on_conditions'),

View File

@@ -11,14 +11,13 @@ import {
FlowNodeTypeEnum
} from '../../../node/constant';
import { type FlowNodeTemplateType } from '../../../type/node';
import { getHandleConfig } from '../../utils';
export const FormInputNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.formInput,
templateType: FlowNodeTemplateTypeEnum.interactive,
flowNodeType: FlowNodeTypeEnum.formInput,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/formInput',
name: i18nT('app:workflow.form_input'),
intro: i18nT(`app:workflow.form_input_tip`),

View File

@@ -11,14 +11,13 @@ import {
FlowNodeTypeEnum
} from '../../../node/constant';
import { type FlowNodeTemplateType } from '../../../type/node.d';
import { getHandleConfig } from '../../utils';
export const UserSelectNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.userSelect,
templateType: FlowNodeTemplateTypeEnum.interactive,
flowNodeType: FlowNodeTypeEnum.userSelect,
sourceHandle: getHandleConfig(false, false, false, false),
targetHandle: getHandleConfig(true, false, true, true),
showSourceHandle: false,
showTargetHandle: true,
avatar: 'core/workflow/template/userSelect',
diagram: '/imgs/app/userSelect.svg',
name: i18nT('app:workflow.user_select'),

View File

@@ -12,7 +12,6 @@ import {
} from '../../constants';
import { Input_Template_DynamicInput } from '../input';
import { Output_Template_AddOutput } from '../output';
import { getHandleConfig } from '../utils';
import { i18nT } from '../../../../../web/i18n/utils';
export const nodeLafCustomInputConfig = {
@@ -25,8 +24,8 @@ export const LafModule: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.lafModule,
templateType: FlowNodeTemplateTypeEnum.other,
flowNodeType: FlowNodeTypeEnum.lafModule,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/lafDispatch',
name: i18nT('workflow:laf_function_call_test'),
intro: i18nT('workflow:intro_laf_function_call'),

View File

@@ -10,7 +10,6 @@ import {
NodeOutputKeyEnum,
WorkflowIOValueTypeEnum
} from '../../../constants';
import { getHandleConfig } from '../../utils';
import { i18nT } from '../../../../../../web/i18n/utils';
import {
Input_Template_Children_Node_List,
@@ -23,8 +22,8 @@ export const LoopNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.loop,
templateType: FlowNodeTemplateTypeEnum.tools,
flowNodeType: FlowNodeTypeEnum.loop,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/loop',
name: i18nT('workflow:loop'),
intro: i18nT('workflow:intro_loop'),

View File

@@ -6,14 +6,13 @@ import {
} from '../../../constants';
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '../../../node/constant';
import { type FlowNodeTemplateType } from '../../../type/node';
import { getHandleConfig } from '../../utils';
export const LoopEndNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.loopEnd,
templateType: FlowNodeTemplateTypeEnum.systemInput,
flowNodeType: FlowNodeTypeEnum.loopEnd,
sourceHandle: getHandleConfig(false, false, false, false),
targetHandle: getHandleConfig(false, false, false, true),
showSourceHandle: false,
showTargetHandle: true,
unique: true,
forbidDelete: true,
avatar: 'core/workflow/template/loopEnd',

View File

@@ -10,15 +10,14 @@ import {
NodeOutputKeyEnum,
WorkflowIOValueTypeEnum
} from '../../../constants';
import { getHandleConfig } from '../../utils';
import { i18nT } from '../../../../../../web/i18n/utils';
export const LoopStartNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.loopStart,
templateType: FlowNodeTemplateTypeEnum.systemInput,
flowNodeType: FlowNodeTypeEnum.loopStart,
sourceHandle: getHandleConfig(false, true, false, false),
targetHandle: getHandleConfig(false, false, false, false),
showSourceHandle: true,
showTargetHandle: false,
avatar: 'core/workflow/template/loopStart',
name: i18nT('workflow:loop_start'),
unique: true,

View File

@@ -1,15 +1,14 @@
import { FlowNodeTypeEnum } from '../../node/constant';
import { type FlowNodeTemplateType } from '../../type/node.d';
import { FlowNodeTemplateTypeEnum } from '../../constants';
import { getHandleConfig } from '../utils';
import { i18nT } from '../../../../../web/i18n/utils';
export const PluginConfigNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.pluginConfig,
templateType: FlowNodeTemplateTypeEnum.systemInput,
flowNodeType: FlowNodeTypeEnum.pluginConfig,
sourceHandle: getHandleConfig(false, false, false, false),
targetHandle: getHandleConfig(false, false, false, false),
showSourceHandle: false,
showTargetHandle: false,
avatar: 'core/workflow/template/systemConfig',
name: i18nT('workflow:template.system_config'),
intro: '',

View File

@@ -2,14 +2,13 @@ import { i18nT } from '../../../../../web/i18n/utils';
import { FlowNodeTemplateTypeEnum } from '../../constants';
import { FlowNodeTypeEnum } from '../../node/constant';
import { type FlowNodeTemplateType } from '../../type/node';
import { getHandleConfig } from '../utils';
export const PluginInputModule: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.pluginInput,
templateType: FlowNodeTemplateTypeEnum.systemInput,
flowNodeType: FlowNodeTypeEnum.pluginInput,
sourceHandle: getHandleConfig(false, true, false, false),
targetHandle: getHandleConfig(false, false, false, false),
showSourceHandle: true,
showTargetHandle: false,
unique: true,
forbidDelete: true,
avatar: 'core/workflow/template/workflowStart',

View File

@@ -2,14 +2,13 @@ import { i18nT } from '../../../../../web/i18n/utils';
import { FlowNodeTemplateTypeEnum } from '../../constants';
import { FlowNodeTypeEnum } from '../../node/constant';
import { type FlowNodeTemplateType } from '../../type/node';
import { getHandleConfig } from '../utils';
export const PluginOutputModule: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.pluginOutput,
templateType: FlowNodeTemplateTypeEnum.systemInput,
flowNodeType: FlowNodeTypeEnum.pluginOutput,
sourceHandle: getHandleConfig(false, false, false, false),
targetHandle: getHandleConfig(false, false, false, true),
showSourceHandle: false,
showTargetHandle: true,
unique: true,
forbidDelete: true,
avatar: 'core/workflow/template/pluginOutput',

View File

@@ -15,16 +15,14 @@ import {
Input_Template_UserChatInput,
Input_Template_SelectAIModel
} from '../input';
import { LLMModelTypeEnum } from '../../../ai/constants';
import { getHandleConfig } from '../utils';
import { i18nT } from '../../../../../web/i18n/utils';
export const AiQueryExtension: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.queryExtension,
templateType: FlowNodeTemplateTypeEnum.other,
flowNodeType: FlowNodeTypeEnum.queryExtension,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/queryExtension',
name: i18nT('workflow:question_optimization'),
intro: i18nT('workflow:intro_question_optimization'),

View File

@@ -11,14 +11,13 @@ import {
FlowNodeTypeEnum
} from '../../../node/constant';
import { type FlowNodeTemplateType } from '../../../type/node';
import { getHandleConfig } from '../../utils';
export const ReadFilesNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.readFiles,
templateType: FlowNodeTemplateTypeEnum.tools,
flowNodeType: FlowNodeTypeEnum.readFiles,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/readFiles',
name: i18nT('app:workflow.read_files'),
intro: i18nT('app:workflow.read_files_tip'),

View File

@@ -1,14 +1,13 @@
import { FlowNodeTemplateTypeEnum } from '../../constants';
import { FlowNodeTypeEnum } from '../../node/constant';
import { type FlowNodeTemplateType } from '../../type/node';
import { getHandleConfig } from '../utils';
export const RunAppNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.appModule,
templateType: FlowNodeTemplateTypeEnum.other,
flowNodeType: FlowNodeTypeEnum.appModule,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
intro: '',
name: '',
showStatus: false,

View File

@@ -1,14 +1,13 @@
import { FlowNodeTemplateTypeEnum } from '../../constants';
import { FlowNodeTypeEnum } from '../../node/constant';
import { type FlowNodeTemplateType } from '../../type/node';
import { getHandleConfig } from '../utils';
export const RunPluginModule: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.pluginModule,
templateType: FlowNodeTemplateTypeEnum.other,
flowNodeType: FlowNodeTypeEnum.pluginModule,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
intro: '',
name: '',
showStatus: false,

View File

@@ -1,14 +1,13 @@
import { FlowNodeTemplateTypeEnum } from '../../constants';
import { FlowNodeTypeEnum } from '../../node/constant';
import { type FlowNodeTemplateType } from '../../type/node';
import { getHandleConfig } from '../utils';
export const RunToolNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.tool,
templateType: FlowNodeTemplateTypeEnum.other,
flowNodeType: FlowNodeTypeEnum.tool,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
intro: '',
name: '',
showStatus: false,

View File

@@ -1,18 +1,17 @@
import { FlowNodeTemplateTypeEnum } from '../../constants';
import { FlowNodeTypeEnum } from '../../node/constant';
import { type FlowNodeTemplateType } from '../../type/node';
import { getHandleConfig } from '../utils';
export const RunToolSetNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.toolSet,
templateType: FlowNodeTemplateTypeEnum.other,
flowNodeType: FlowNodeTypeEnum.toolSet,
sourceHandle: getHandleConfig(false, false, false, false),
targetHandle: getHandleConfig(false, false, false, false),
showSourceHandle: false,
showTargetHandle: false,
isTool: true,
intro: '',
name: '',
showStatus: false,
isTool: true,
inputs: [],
outputs: []
};

View File

@@ -10,7 +10,6 @@ import {
FlowNodeTypeEnum
} from '../../../node/constant';
import { type FlowNodeTemplateType } from '../../../type/node';
import { getHandleConfig } from '../../utils';
import { Input_Template_DynamicInput } from '../../input';
import { Output_Template_AddOutput } from '../../output';
import { JS_TEMPLATE } from './constants';
@@ -20,8 +19,8 @@ export const CodeNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.code,
templateType: FlowNodeTemplateTypeEnum.tools,
flowNodeType: FlowNodeTypeEnum.code,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/codeRun',
name: i18nT('workflow:code_execution'),
intro: i18nT('workflow:execute_a_simple_script_code_usually_for_complex_data_processing'),

View File

@@ -1,15 +1,14 @@
import { FlowNodeTypeEnum } from '../../node/constant';
import { type FlowNodeTemplateType } from '../../type/node';
import { FlowNodeTemplateTypeEnum } from '../../constants';
import { getHandleConfig } from '../utils';
import { i18nT } from '../../../../../web/i18n/utils';
export const StopToolNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.stopTool,
templateType: FlowNodeTemplateTypeEnum.ai,
flowNodeType: FlowNodeTypeEnum.stopTool,
sourceHandle: getHandleConfig(false, false, false, false),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: false,
showTargetHandle: true,
avatar: 'core/workflow/template/stopTool',
name: i18nT('workflow:tool_call_termination'),
intro: i18nT('workflow:intro_tool_call_termination'),

View File

@@ -1,15 +1,14 @@
import { FlowNodeTypeEnum } from '../../node/constant';
import { type FlowNodeTemplateType } from '../../type/node.d';
import { FlowNodeTemplateTypeEnum } from '../../constants';
import { getHandleConfig } from '../utils';
import { i18nT } from '../../../../../web/i18n/utils';
export const SystemConfigNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.systemConfig,
templateType: FlowNodeTemplateTypeEnum.systemInput,
flowNodeType: FlowNodeTypeEnum.systemConfig,
sourceHandle: getHandleConfig(false, false, false, false),
targetHandle: getHandleConfig(false, false, false, false),
showSourceHandle: false,
showTargetHandle: false,
avatar: 'core/workflow/template/systemConfig',
name: i18nT('workflow:template.system_config'),
intro: '',

View File

@@ -10,16 +10,14 @@ import {
FlowNodeTemplateTypeEnum,
NodeInputKeyEnum
} from '../../constants';
import { getHandleConfig } from '../utils';
import { Input_Template_DynamicInput } from '../input';
import { i18nT } from '../../../../../web/i18n/utils';
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),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/textConcat',
name: i18nT('workflow:text_concatenation'),
intro: i18nT('workflow:intro_text_concatenation'),

View File

@@ -1,15 +1,14 @@
import { FlowNodeTypeEnum } from '../../node/constant';
import { type FlowNodeTemplateType } from '../../type/node';
import { FlowNodeTemplateTypeEnum } from '../../constants';
import { getHandleConfig } from '../utils';
import { i18nT } from '../../../../../web/i18n/utils';
export const ToolParamsNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.toolParams,
templateType: FlowNodeTemplateTypeEnum.ai,
flowNodeType: FlowNodeTypeEnum.toolParams,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/toolParams',
name: i18nT('workflow:tool_custom_field'),
intro: i18nT('workflow:intro_tool_params_config'),

View File

@@ -5,15 +5,14 @@ import {
NodeInputKeyEnum,
WorkflowIOValueTypeEnum
} from '../../../constants';
import { getHandleConfig } from '../../utils';
import { i18nT } from '../../../../../../web/i18n/utils';
export const VariableUpdateNode: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.variableUpdate,
templateType: FlowNodeTemplateTypeEnum.tools,
flowNodeType: FlowNodeTypeEnum.variableUpdate,
sourceHandle: getHandleConfig(true, true, true, true),
targetHandle: getHandleConfig(true, true, true, true),
showSourceHandle: true,
showTargetHandle: true,
avatar: 'core/workflow/template/variableUpdate',
name: i18nT('workflow:variable_update'),
intro: i18nT('workflow:update_specified_node_output_or_global_variable'),

View File

@@ -5,7 +5,6 @@ import {
NodeOutputKeyEnum,
FlowNodeTemplateTypeEnum
} from '../../constants';
import { getHandleConfig } from '../utils';
import { Input_Template_UserChatInput } from '../input';
import { i18nT } from '../../../../../web/i18n/utils';
import { type FlowNodeOutputItemType } from '../../type/io';
@@ -23,8 +22,8 @@ export const WorkflowStart: FlowNodeTemplateType = {
id: FlowNodeTypeEnum.workflowStart,
templateType: FlowNodeTemplateTypeEnum.systemInput,
flowNodeType: FlowNodeTypeEnum.workflowStart,
sourceHandle: getHandleConfig(false, true, false, false),
targetHandle: getHandleConfig(false, false, false, false),
showSourceHandle: true,
showTargetHandle: false,
avatar: 'core/workflow/template/workflowStart',
name: i18nT('workflow:template.workflow_start'),
intro: '',

View File

@@ -1,2 +1,4 @@
export const chatNodeSystemPromptTip = 'core.app.tip.chatNodeSystemPromptTip';
export const systemPromptTip = 'core.app.tip.systemPromptTip';
import { i18nT } from '../../../../web/i18n/utils';
export const chatNodeSystemPromptTip = i18nT('common:core.app.tip.chatNodeSystemPromptTip');
export const systemPromptTip = i18nT('common:core.app.tip.systemPromptTip');

View File

@@ -1,6 +0,0 @@
export const getHandleConfig = (top: boolean, right: boolean, bottom: boolean, left: boolean) => ({
top,
right,
bottom,
left
});

View File

@@ -1,47 +0,0 @@
import type { FlowNodeInputItemType, FlowNodeOutputItemType } from './io';
export type FlowNodeChangeProps = { nodeId: string } & (
| {
type: 'attr'; // key: attr, value: new value
key: string;
value: any;
}
| {
type: 'updateInput'; // key: update input key, value: new input value
key: string;
value: FlowNodeInputItemType;
}
| {
type: 'replaceInput'; // key: old input key, value: new input value
key: string;
value: FlowNodeInputItemType;
}
| {
type: 'addInput'; // key: null, value: new input value
value: FlowNodeInputItemType;
index?: number;
}
| {
type: 'delInput'; // key: delete input key, value: null
key: string;
}
| {
type: 'updateOutput'; // key: update output key, value: new output value
key: string;
value: FlowNodeOutputItemType;
}
| {
type: 'replaceOutput'; // key: old output key, value: new output value
key: string;
value: FlowNodeOutputItemType;
}
| {
type: 'addOutput'; // key: null, value: new output value
value: FlowNodeOutputItemType;
index?: number;
}
| {
type: 'delOutput'; // key: delete output key, value: null
key: string;
}
);

View File

@@ -6,7 +6,8 @@ import {
VariableInputEnum
} from '../constants';
import { DispatchNodeResponseKeyEnum } from '../runtime/constants';
import { CustomInputItemType, FlowNodeInputItemType, FlowNodeOutputItemType } from './io.d';
import type { FlowNodeInputItemType, FlowNodeOutputItemType } from './io.d';
import { CustomInputItemType } from './io.d';
import {
ChatHistoryItemResType,
ChatItemType,
@@ -14,13 +15,14 @@ import {
ToolRunResponseItemType
} from '../../chat/type';
import { ChatNodeUsageType } from '../../../support/wallet/bill/type';
import { PluginTypeEnum } from '../../plugin/constants';
import type { StoreEdgeItemType } from './edge';
import type { AppChatConfigType } from '../../app/type';
import type { ParentIdType } from 'common/parentFolder/type';
import type { AppTypeEnum } from 'core/app/constants';
import type { StoreNodeItemType } from './node';
import { FlowNodeTemplateType } from './node';
import type { SecretValueType } from './../../../common/secret/type';
import type { I18nStringType } from '../../../common/i18n/type';
export type WorkflowTemplateBasicType = {
nodes: StoreNodeItemType[];
@@ -32,19 +34,15 @@ export type WorkflowTemplateType = {
parentId?: ParentIdType;
isFolder?: boolean;
name: string;
avatar: string;
intro?: string;
name: I18nStringType | string;
intro?: I18nStringType | string;
author?: string;
courseUrl?: string;
version?: string;
versionLabel?: string;
isLatestVersion?: boolean;
showStatus?: boolean;
weight?: number;
version?: string;
workflow: WorkflowTemplateBasicType;
};
@@ -63,43 +61,3 @@ export type TemplateMarketListItemType = {
type: AppTypeEnum.simple | AppTypeEnum.workflow | AppTypeEnum.plugin;
avatar: string;
};
// system plugin
export type SystemPluginTemplateItemType = WorkflowTemplateType & {
customWorkflow?: string;
associatedPluginId?: string;
userGuide?: string;
templateType: string;
isTool?: boolean;
// commercial plugin config
originCost: number; // n points/one time
currentCost: number;
hasTokenFee: boolean;
pluginOrder: number;
isActive?: boolean;
isOfficial?: boolean;
inputConfig?: {
// Render config input form. Find the corresponding node and replace the variable directly
key: string;
label: string;
description: string;
value?: any;
}[];
};
export type THelperLine = {
position: number;
nodes: {
left: number;
right: number;
top: number;
bottom: number;
width: number;
height: number;
centerX: number;
centerY: number;
}[];
};

View File

@@ -1,7 +1,8 @@
import type { LLMModelItemType } from '../../ai/model.d';
import type { EmbeddingModelItemType, LLMModelItemType } from '../../ai/model.d';
import type { LLMModelTypeEnum } from '../../ai/constants';
import type { WorkflowIOValueTypeEnum, NodeInputKeyEnum, NodeOutputKeyEnum } from '../constants';
import type { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum } from '../node/constant';
import type { SecretValueType } from '../../../common/secret/type';
// Dynamic input field configuration
export type CustomFieldConfigType = {
@@ -10,11 +11,6 @@ export type CustomFieldConfigType = {
// reference
selectValueTypeList?: WorkflowIOValueTypeEnum[]; // 可以选哪个数据类型, 只有1个的话,则默认选择
// showIsToolParam?: boolean; // 是否作为工具参数
// showRequired?: boolean;
// defaultRequired?: boolean;
showDefaultValue?: boolean;
showDescription?: boolean;
};
@@ -29,6 +25,7 @@ export type InputComponentPropsType = {
step?: number; // slider
max?: number; // slider, number input
min?: number; // slider, number input
precision?: number; // number input
defaultValue?: string;
@@ -37,6 +34,17 @@ export type InputComponentPropsType = {
// dynamic input
customInputConfig?: CustomFieldConfigType;
};
export type InputConfigType = {
key: string;
label: string;
description?: string;
required?: boolean;
inputType: 'input' | 'numberInput' | 'secret' | 'switch' | 'select';
value?: SecretValueType;
// Selector
list?: { label: string; value: string }[];
};
export type FlowNodeInputItemType = InputComponentPropsType & {
selectedTypeIndex?: number;
@@ -52,6 +60,8 @@ export type FlowNodeInputItemType = InputComponentPropsType & {
required?: boolean;
enum?: string;
inputList?: InputConfigType[]; // when key === 'system_input_config', this field is used
toolDescription?: string; // If this field is not empty, it is entered as a tool
// render components params
@@ -92,6 +102,21 @@ export type FlowNodeOutputItemType = {
deprecated?: boolean;
};
// Field value type
export type ReferenceItemValueType = [string, string | undefined];
export type ReferenceArrayValueType = ReferenceItemValueType[];
export type ReferenceValueType = ReferenceItemValueType | ReferenceArrayValueType;
export type SelectedDatasetType = {
datasetId: string;
avatar: string;
name: string;
vectorModel: EmbeddingModelItemType;
}[];
/* http node */
export type HttpParamAndHeaderItemType = {
key: string;
type: string;
value: string;
};

View File

@@ -17,7 +17,6 @@ import {
} 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 type { AppDetailType, AppSchema, McpToolConfigType } from '../../app/type';
@@ -29,6 +28,9 @@ export type NodeToolConfigType = {
mcpTool?: McpToolConfigType & {
url: string;
};
systemTool?: {
toolId: string;
};
};
export type FlowNodeCommonType = {
@@ -55,7 +57,12 @@ export type FlowNodeCommonType = {
pluginData?: PluginDataType;
// tool data
toolData?: NodeToolConfigType;
toolConfig?: NodeToolConfigType;
// Not store, just computed
currentCost?: number;
hasTokenFee?: boolean;
hasSystemSecret?: boolean;
};
export type PluginDataType = {
@@ -78,9 +85,8 @@ export type FlowNodeTemplateType = FlowNodeCommonType & {
id: string; // node id, unique
templateType: string;
// show handle
sourceHandle?: HandleType;
targetHandle?: HandleType;
showSourceHandle?: boolean;
showTargetHandle?: boolean;
// info
isTool?: boolean; // can be connected by tool
@@ -92,6 +98,11 @@ export type FlowNodeTemplateType = FlowNodeCommonType & {
diagram?: string; // diagram url
courseUrl?: string; // course url
userGuide?: string; // user guide
// @deprecated
// show handle
sourceHandle?: HandleType;
targetHandle?: HandleType;
};
export type NodeTemplateListItemType = {

View File

@@ -274,9 +274,6 @@ export const appData2FlowNodeIO = ({
};
});
// const showFileLink =
// chatConfig?.fileSelectConfig?.canSelectFile || chatConfig?.fileSelectConfig?.canSelectImg;
return {
inputs: [
Input_Template_Stream_MODE,
@@ -356,7 +353,7 @@ export const formatEditorVariablePickerIcon = (
export const isValidReferenceValueFormat = (value: any): value is ReferenceItemValueType => {
return Array.isArray(value) && value.length === 2 && typeof value[0] === 'string';
};
/*
/*
Check whether the value([variableId, outputId]) value is a valid reference value:
1. The value must be an array of length 2
2. The first item of the array must be one of VARIABLE_NODE_ID or nodeIds
@@ -370,7 +367,7 @@ export const isValidReferenceValue = (
const validIdSet = new Set([VARIABLE_NODE_ID, ...nodeIds]);
return validIdSet.has(value[0]);
};
/*
/*
Check whether the value([variableId, outputId][]) value is a valid reference value array:
1. The value must be an array
2. The array must contain at least one element