9
9
AI_CATEGORY_MCP_NODES ,
10
10
AI_CATEGORY_ROOT_NODES ,
11
11
AI_CATEGORY_TOOLS ,
12
+ AI_CATEGORY_VECTOR_STORES ,
12
13
AI_CODE_NODE_TYPE ,
13
14
AI_NODE_CREATOR_VIEW ,
14
15
AI_OTHERS_NODE_CREATOR_VIEW ,
@@ -122,14 +123,14 @@ export const useViewStacks = defineStore('nodeCreatorViewStacks', () => {
122
123
123
124
const searchResults = extendItemsWithUUID ( searchNodes ( stack . search || '' , searchBase ) ) ;
124
125
125
- const groupedNodes = groupIfAiNodes ( searchResults , false ) ?? searchResults ;
126
+ const groupedNodes = groupIfAiNodes ( searchResults , stack . title , false ) ?? searchResults ;
126
127
// Set the active index to the second item if there's a section
127
128
// as the first item is collapsable
128
129
stack . activeIndex = groupedNodes . some ( ( node ) => node . type === 'section' ) ? 1 : 0 ;
129
130
130
131
return groupedNodes ;
131
132
}
132
- return extendItemsWithUUID ( groupIfAiNodes ( stack . baselineItems , true ) ) ;
133
+ return extendItemsWithUUID ( groupIfAiNodes ( stack . baselineItems , stack . title , true ) ) ;
133
134
} ) ;
134
135
135
136
const activeViewStack = computed < ViewStack > ( ( ) => {
@@ -146,7 +147,7 @@ export const useViewStacks = defineStore('nodeCreatorViewStacks', () => {
146
147
} ) ;
147
148
148
149
const activeViewStackMode = computed (
149
- ( ) => activeViewStack . value . mode || TRIGGER_NODE_CREATOR_VIEW ,
150
+ ( ) => activeViewStack . value . mode ?? TRIGGER_NODE_CREATOR_VIEW ,
150
151
) ;
151
152
152
153
const searchBaseItems = computed < INodeCreateElement [ ] > ( ( ) => {
@@ -183,7 +184,7 @@ export const useViewStacks = defineStore('nodeCreatorViewStacks', () => {
183
184
searchNodes ( stack . search || '' , filteredNodes ) ,
184
185
) ;
185
186
if ( isAiRootView ( stack ) ) {
186
- globalSearchResult = groupIfAiNodes ( globalSearchResult ) ;
187
+ globalSearchResult = groupIfAiNodes ( globalSearchResult , stack . title , false ) ;
187
188
}
188
189
189
190
const filteredItems = globalSearchResult . filter ( ( item ) => {
@@ -233,7 +234,11 @@ export const useViewStacks = defineStore('nodeCreatorViewStacks', () => {
233
234
} ) ;
234
235
}
235
236
236
- function groupIfAiNodes ( items : INodeCreateElement [ ] , sortAlphabetically = true ) {
237
+ function groupIfAiNodes (
238
+ items : INodeCreateElement [ ] ,
239
+ stackCategory : string | undefined ,
240
+ sortAlphabetically : boolean ,
241
+ ) {
237
242
const aiNodes = items . filter ( ( node ) : node is NodeCreateElement => isAINode ( node ) ) ;
238
243
const canvasHasAINodes = useCanvasStore ( ) . aiNodes . length > 0 ;
239
244
@@ -247,7 +252,12 @@ export const useViewStacks = defineStore('nodeCreatorViewStacks', () => {
247
252
const section = subcategories [ AI_SUBCATEGORY ] ?. [ 0 ] ;
248
253
249
254
if ( section ) {
250
- const subSection = subcategories [ section ] ?. [ 0 ] ;
255
+ // Don't show sub sections for Vector Stores if we're currently viewing a 'Tools' stack
256
+ const subSection =
257
+ section === AI_CATEGORY_VECTOR_STORES && stackCategory === AI_CATEGORY_TOOLS
258
+ ? undefined
259
+ : subcategories [ section ] ?. [ 0 ] ;
260
+
251
261
const sectionKey = subSection ?? section ;
252
262
const currentItems = sectionsMap . get ( sectionKey ) ?. items ?? [ ] ;
253
263
const isSubnodesSection = ! (
0 commit comments