@@ -54,9 +54,16 @@ function a11yProps(index) {
54
54
}
55
55
}
56
56
57
- const blacklistCategoriesForAgentCanvas = [ 'Agents' , 'Memory' , 'Record Manager' ]
58
- const allowedAgentModel = { }
59
- const exceptions = {
57
+ const blacklistCategoriesForAgentCanvas = [ 'Agents' , 'Memory' , 'Record Manager' , 'Utilities' ]
58
+
59
+ // Show blacklisted nodes (exceptions) for agent canvas
60
+ const exceptionsForAgentCanvas = {
61
+ Memory : [ 'agentMemory' ] ,
62
+ Utilities : [ 'getVariable' , 'setVariable' , 'stickyNote' ]
63
+ }
64
+
65
+ // Hide some nodes from the chatflow canvas
66
+ const blacklistForChatflowCanvas = {
60
67
Memory : [ 'agentMemory' ]
61
68
}
62
69
@@ -87,11 +94,16 @@ const AddNodes = ({ nodesData, node, isAgentCanvas }) => {
87
94
filterSearch ( searchValue , newValue )
88
95
}
89
96
90
- const addException = ( ) => {
97
+ const addException = ( category ) => {
91
98
let nodes = [ ]
92
- for ( const category in exceptions ) {
93
- const nodeNames = exceptions [ category ]
94
- nodes . push ( ...nodesData . filter ( ( nd ) => nd . category === category && nodeNames . includes ( nd . name ) ) )
99
+ if ( category ) {
100
+ const nodeNames = exceptionsForAgentCanvas [ category ] || [ ]
101
+ nodes = nodesData . filter ( ( nd ) => nd . category === category && nodeNames . includes ( nd . name ) )
102
+ } else {
103
+ for ( const category in exceptionsForAgentCanvas ) {
104
+ const nodeNames = exceptionsForAgentCanvas [ category ]
105
+ nodes . push ( ...nodesData . filter ( ( nd ) => nd . category === category && nodeNames . includes ( nd . name ) ) )
106
+ }
95
107
}
96
108
return nodes
97
109
}
@@ -108,7 +120,13 @@ const AddNodes = ({ nodesData, node, isAgentCanvas }) => {
108
120
} )
109
121
return passed
110
122
}
111
- const nodes = nodesData . filter ( ( nd ) => nd . category !== 'Multi Agents' && nd . category !== 'Sequential Agents' )
123
+ let nodes = nodesData . filter ( ( nd ) => nd . category !== 'Multi Agents' && nd . category !== 'Sequential Agents' )
124
+
125
+ for ( const category in blacklistForChatflowCanvas ) {
126
+ const nodeNames = blacklistForChatflowCanvas [ category ]
127
+ nodes = nodes . filter ( ( nd ) => ! nodeNames . includes ( nd . name ) )
128
+ }
129
+
112
130
const passed = nodes . filter ( ( nd ) => {
113
131
const passesName = nd . name . toLowerCase ( ) . includes ( value . toLowerCase ( ) )
114
132
const passesLabel = nd . label . toLowerCase ( ) . includes ( value . toLowerCase ( ) )
@@ -163,18 +181,12 @@ const AddNodes = ({ nodesData, node, isAgentCanvas }) => {
163
181
const nodes = result [ category ] . filter ( ( nd ) => ! nd . tags || ! nd . tags . includes ( 'LlamaIndex' ) )
164
182
if ( ! nodes . length ) continue
165
183
166
- // Only allow specific models for specific categories
167
- if ( Object . keys ( allowedAgentModel ) . includes ( category ) ) {
168
- const allowedModels = allowedAgentModel [ category ]
169
- filteredResult [ category ] = nodes . filter ( ( nd ) => allowedModels . includes ( nd . name ) )
170
- } else {
171
- filteredResult [ category ] = nodes
172
- }
184
+ filteredResult [ category ] = nodes
173
185
}
174
186
175
- // Allow exceptions
176
- if ( Object . keys ( exceptions ) . includes ( category ) ) {
177
- filteredResult [ category ] = addException ( )
187
+ // Allow exceptionsForAgentCanvas
188
+ if ( Object . keys ( exceptionsForAgentCanvas ) . includes ( category ) ) {
189
+ filteredResult [ category ] = addException ( category )
178
190
}
179
191
}
180
192
setNodes ( filteredResult )
@@ -197,8 +209,13 @@ const AddNodes = ({ nodesData, node, isAgentCanvas }) => {
197
209
if ( category === 'Multi Agents' || category === 'Sequential Agents' ) {
198
210
continue
199
211
}
212
+ if ( Object . keys ( blacklistForChatflowCanvas ) . includes ( category ) ) {
213
+ const nodes = blacklistForChatflowCanvas [ category ]
214
+ result [ category ] = result [ category ] . filter ( ( nd ) => ! nodes . includes ( nd . name ) )
215
+ }
200
216
filteredResult [ category ] = result [ category ]
201
217
}
218
+
202
219
setNodes ( filteredResult )
203
220
setCategoryExpanded ( accordianCategories )
204
221
}
0 commit comments