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 {
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<FlowNodeItemType, string | undefined>[];
edges: Edge<any>[];
}): 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) {