node pluginoutput check (#3074)

This commit is contained in:
heheer
2024-11-05 18:04:42 +08:00
committed by archer
parent ba61c9e2e6
commit 2388652858

View File

@@ -22,7 +22,8 @@ import { EditorVariablePickerType } from '@fastgpt/web/components/common/Textare
import { import {
formatEditorVariablePickerIcon, formatEditorVariablePickerIcon,
getAppChatConfig, getAppChatConfig,
getGuideModule getGuideModule,
isReferenceValue
} from '@fastgpt/global/core/workflow/utils'; } from '@fastgpt/global/core/workflow/utils';
import { TFunction } from 'next-i18next'; import { TFunction } from 'next-i18next';
import { import {
@@ -269,6 +270,7 @@ export const checkWorkflowNodeAndConnection = ({
nodes: Node<FlowNodeItemType, string | undefined>[]; nodes: Node<FlowNodeItemType, string | undefined>[];
edges: Edge<any>[]; edges: Edge<any>[];
}): string[] | undefined => { }): string[] | undefined => {
const nodeIds: string[] = nodes.map((node) => node.data.nodeId);
// 1. reference check. Required value // 1. reference check. Required value
for (const node of nodes) { for (const node of nodes) {
const data = node.data; const data = node.data;
@@ -324,6 +326,13 @@ export const checkWorkflowNodeAndConnection = ({
if (input.value === undefined) return true; if (input.value === undefined) return true;
} }
if (
node.data.flowNodeType === FlowNodeTypeEnum.pluginOutput &&
!(isReferenceValue(input.value, nodeIds) && input.value[1])
) {
return true;
}
// check reference invalid // check reference invalid
const renderType = input.renderTypeList[input.selectedTypeIndex || 0]; const renderType = input.renderTypeList[input.selectedTypeIndex || 0];
if (renderType === FlowNodeInputTypeEnum.reference && input.required) { if (renderType === FlowNodeInputTypeEnum.reference && input.required) {