loop node dynamic height (#3092)
* loop node dynamic height * fix * fix
This commit is contained in:
@@ -5,7 +5,7 @@ import { StoreNodeItemType } from '../type/node';
|
||||
import { StoreEdgeItemType } from '../type/edge';
|
||||
import { RuntimeEdgeItemType, RuntimeNodeItemType } from './type';
|
||||
import { VARIABLE_NODE_ID } from '../constants';
|
||||
import { isReferenceValue, isReferenceValueArray } from '../utils';
|
||||
import { isReferenceValueFormat } from '../utils';
|
||||
import { FlowNodeOutputItemType, ReferenceValueType } from '../type/io';
|
||||
import { ChatItemType, NodeOutputItemType } from '../../../core/chat/type';
|
||||
import { ChatItemValueTypeEnum, ChatRoleEnum } from '../../../core/chat/constants';
|
||||
@@ -244,7 +244,7 @@ export const getReferenceVariableValue = ({
|
||||
const nodeIds = nodes.map((node) => node.nodeId);
|
||||
|
||||
// handle single reference value
|
||||
if (isReferenceValue(value, nodeIds)) {
|
||||
if (isReferenceValueFormat(value)) {
|
||||
const sourceNodeId = value[0];
|
||||
const outputId = value[1];
|
||||
|
||||
@@ -261,7 +261,11 @@ export const getReferenceVariableValue = ({
|
||||
}
|
||||
|
||||
// handle reference array
|
||||
if (isReferenceValueArray(value, nodeIds)) {
|
||||
if (
|
||||
Array.isArray(value) &&
|
||||
value.length > 0 &&
|
||||
value.every((item) => isReferenceValueFormat(item))
|
||||
) {
|
||||
const result = value.map<any>((val) => {
|
||||
return getReferenceVariableValue({
|
||||
value: val,
|
||||
@@ -270,7 +274,7 @@ export const getReferenceVariableValue = ({
|
||||
});
|
||||
});
|
||||
|
||||
return result.flat();
|
||||
return result.flat().filter((item) => item !== undefined);
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
@@ -111,7 +111,7 @@ export const Input_Template_Node_Height: FlowNodeInputItemType = {
|
||||
renderTypeList: [FlowNodeInputTypeEnum.hidden],
|
||||
valueType: WorkflowIOValueTypeEnum.number,
|
||||
label: '',
|
||||
value: 960
|
||||
value: 600
|
||||
};
|
||||
|
||||
export const Input_Template_Stream_MODE: FlowNodeInputItemType = {
|
||||
|
||||
@@ -306,6 +306,15 @@ export const isReferenceValue = (value: any, nodeIds: string[]): value is [strin
|
||||
const validIdSet = new Set([VARIABLE_NODE_ID, ...nodeIds]);
|
||||
return validIdSet.has(value[0]);
|
||||
};
|
||||
|
||||
export const isReferenceValueFormat = (value: any): value is [string, string] => {
|
||||
return (
|
||||
Array.isArray(value) &&
|
||||
value.length === 2 &&
|
||||
typeof value[0] === 'string' &&
|
||||
typeof value[1] === 'string'
|
||||
);
|
||||
};
|
||||
export const isReferenceValueArray = (
|
||||
value: any,
|
||||
nodeIds: string[]
|
||||
|
||||
Reference in New Issue
Block a user