feat(editor): Tweak nodes panel to update AI category name and highlight AI Transform node (#14608)

This commit is contained in:
Mutasem Aldmour
2025-04-14 14:06:26 +02:00
committed by GitHub
parent 53812a544f
commit 9c34e3d534
2 changed files with 23 additions and 15 deletions

View File

@@ -110,25 +110,29 @@ interface NodeView {
items: NodeViewItem[];
}
function getNodeView(node: INodeTypeDescription) {
return {
key: node.name,
type: 'node',
properties: {
group: [],
name: node.name,
displayName: node.displayName,
title: node.displayName,
description: node.description,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
icon: node.icon!,
iconUrl: node.iconUrl,
},
};
}
function getAiNodesBySubcategory(nodes: INodeTypeDescription[], subcategory: string) {
return nodes
.filter(
(node) => !node.hidden && node.codex?.subcategories?.[AI_SUBCATEGORY]?.includes(subcategory),
)
.map((node) => ({
key: node.name,
type: 'node',
properties: {
group: [],
name: node.name,
displayName: node.displayName,
title: node.displayName,
description: node.description,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
icon: node.icon!,
iconUrl: node.iconUrl,
},
}))
.map(getNodeView)
.sort((a, b) => a.properties.displayName.localeCompare(b.properties.displayName));
}
@@ -145,6 +149,9 @@ export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
const websiteCategoryURL =
templatesStore.constructTemplateRepositoryURL(websiteCategoryURLParams);
const aiTransformNode = nodeTypesStore.getNodeType(AI_TRANSFORM_NODE_TYPE);
const transformNode = aiTransformNode ? [getNodeView(aiTransformNode)] : [];
return {
value: AI_NODE_CREATOR_VIEW,
title: i18n.baseText('nodeCreator.aiPanel.aiNodes'),
@@ -167,6 +174,7 @@ export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
},
...agentNodes,
...chainNodes,
...transformNode,
{
key: AI_OTHERS_NODE_CREATOR_VIEW,
type: 'view',