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[]; 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) { function getAiNodesBySubcategory(nodes: INodeTypeDescription[], subcategory: string) {
return nodes return nodes
.filter( .filter(
(node) => !node.hidden && node.codex?.subcategories?.[AI_SUBCATEGORY]?.includes(subcategory), (node) => !node.hidden && node.codex?.subcategories?.[AI_SUBCATEGORY]?.includes(subcategory),
) )
.map((node) => ({ .map(getNodeView)
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,
},
}))
.sort((a, b) => a.properties.displayName.localeCompare(b.properties.displayName)); .sort((a, b) => a.properties.displayName.localeCompare(b.properties.displayName));
} }
@@ -145,6 +149,9 @@ export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
const websiteCategoryURL = const websiteCategoryURL =
templatesStore.constructTemplateRepositoryURL(websiteCategoryURLParams); templatesStore.constructTemplateRepositoryURL(websiteCategoryURLParams);
const aiTransformNode = nodeTypesStore.getNodeType(AI_TRANSFORM_NODE_TYPE);
const transformNode = aiTransformNode ? [getNodeView(aiTransformNode)] : [];
return { return {
value: AI_NODE_CREATOR_VIEW, value: AI_NODE_CREATOR_VIEW,
title: i18n.baseText('nodeCreator.aiPanel.aiNodes'), title: i18n.baseText('nodeCreator.aiPanel.aiNodes'),
@@ -167,6 +174,7 @@ export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
}, },
...agentNodes, ...agentNodes,
...chainNodes, ...chainNodes,
...transformNode,
{ {
key: AI_OTHERS_NODE_CREATOR_VIEW, key: AI_OTHERS_NODE_CREATOR_VIEW,
type: 'view', type: 'view',

View File

@@ -1278,7 +1278,7 @@
"nodeCreator.aiPanel.selectAiNode": "Select an Al Node to add to your workflow", "nodeCreator.aiPanel.selectAiNode": "Select an Al Node to add to your workflow",
"nodeCreator.aiPanel.nodesForAi": "Build autonomous agents, summarize or search documents, etc.", "nodeCreator.aiPanel.nodesForAi": "Build autonomous agents, summarize or search documents, etc.",
"nodeCreator.aiPanel.newTag": "New", "nodeCreator.aiPanel.newTag": "New",
"nodeCreator.aiPanel.langchainAiNodes": "Advanced AI", "nodeCreator.aiPanel.langchainAiNodes": "AI",
"nodeCreator.aiPanel.title": "When should this workflow run?", "nodeCreator.aiPanel.title": "When should this workflow run?",
"nodeCreator.aiPanel.linkItem.description": "See what's possible and get started 5x faster", "nodeCreator.aiPanel.linkItem.description": "See what's possible and get started 5x faster",
"nodeCreator.aiPanel.linkItem.title": "AI Templates", "nodeCreator.aiPanel.linkItem.title": "AI Templates",