From 2388652858a57f28d9faeced585bbbe74b5618c9 Mon Sep 17 00:00:00 2001 From: heheer Date: Tue, 5 Nov 2024 18:04:42 +0800 Subject: [PATCH] node pluginoutput check (#3074) --- projects/app/src/web/core/workflow/utils.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/app/src/web/core/workflow/utils.ts b/projects/app/src/web/core/workflow/utils.ts index ebfb83a89..c8c9df740 100644 --- a/projects/app/src/web/core/workflow/utils.ts +++ b/projects/app/src/web/core/workflow/utils.ts @@ -22,7 +22,8 @@ import { EditorVariablePickerType } from '@fastgpt/web/components/common/Textare import { formatEditorVariablePickerIcon, getAppChatConfig, - getGuideModule + getGuideModule, + isReferenceValue } from '@fastgpt/global/core/workflow/utils'; import { TFunction } from 'next-i18next'; import { @@ -269,6 +270,7 @@ export const checkWorkflowNodeAndConnection = ({ nodes: Node[]; edges: Edge[]; }): string[] | undefined => { + const nodeIds: string[] = nodes.map((node) => node.data.nodeId); // 1. reference check. Required value for (const node of nodes) { const data = node.data; @@ -324,6 +326,13 @@ export const checkWorkflowNodeAndConnection = ({ if (input.value === undefined) return true; } + if ( + node.data.flowNodeType === FlowNodeTypeEnum.pluginOutput && + !(isReferenceValue(input.value, nodeIds) && input.value[1]) + ) { + return true; + } + // check reference invalid const renderType = input.renderTypeList[input.selectedTypeIndex || 0]; if (renderType === FlowNodeInputTypeEnum.reference && input.required) {