MCPcopy
hub / github.com/FlowiseAI/Flowise / initNode

Function initNode

packages/ui/src/utils/genericHelper.js:118–231  ·  view source on GitHub ↗
(nodeData, newNodeId, isAgentflow)

Source from the content-addressed store, hash-verified

116}
117
118export const initNode = (nodeData, newNodeId, isAgentflow) => {
119 const inputAnchors = []
120 const inputParams = []
121 const incoming = nodeData.inputs ? nodeData.inputs.length : 0
122
123 const whitelistTypes = [
124 'asyncOptions',
125 'asyncMultiOptions',
126 'options',
127 'multiOptions',
128 'array',
129 'datagrid',
130 'string',
131 'number',
132 'boolean',
133 'password',
134 'json',
135 'code',
136 'date',
137 'file',
138 'folder',
139 'tabs',
140 'conditionFunction', // This is a special type for condition functions
141 'timePicker',
142 'weekDaysPicker',
143 'monthDaysPicker',
144 'datePicker'
145 ]
146
147 // Inputs
148 for (let i = 0; i < incoming; i += 1) {
149 const newInput = {
150 ...nodeData.inputs[i],
151 id: `${newNodeId}-input-${nodeData.inputs[i].name}-${nodeData.inputs[i].type}`
152 }
153 if (whitelistTypes.includes(nodeData.inputs[i].type)) {
154 inputParams.push(newInput)
155 } else {
156 inputAnchors.push(newInput)
157 }
158 }
159
160 // Credential
161 if (nodeData.credential) {
162 const newInput = {
163 ...nodeData.credential,
164 id: `${newNodeId}-input-${nodeData.credential.name}-${nodeData.credential.type}`
165 }
166 inputParams.unshift(newInput)
167 }
168
169 // Outputs
170 let outputAnchors = initializeOutputAnchors(nodeData, newNodeId, isAgentflow)
171
172 /* Initial
173 inputs = [
174 {
175 label: 'field_label_1',

Callers 14

NodeInputHandlerFunction · 0.90
CanvasFunction · 0.90
AgentflowCanvasFunction · 0.90
loadComponentDataFunction · 0.90
onEmbeddingsSelectedFunction · 0.90
onVectorStoreSelectedFunction · 0.90
onRecordManagerSelectedFunction · 0.90
fetchVectorStoreDetailsFunction · 0.90
DeleteDocStoreDialogFunction · 0.90
addDocStoreFunction · 0.90

Calls 4

initializeOutputAnchorsFunction · 0.70
showHideInputAnchorsFunction · 0.70
showHideInputParamsFunction · 0.70

Tested by

no test coverage detected