fix(n8n Evaluation Trigger Node): Fix tweaks (#15473)

This commit is contained in:
Dana
2025-05-19 11:33:07 +02:00
committed by GitHub
parent 5c3840583d
commit 3985387204
7 changed files with 51 additions and 14 deletions

View File

@@ -139,6 +139,32 @@ function getAiNodesBySubcategory(nodes: INodeTypeDescription[], subcategory: str
.sort((a, b) => a.properties.displayName.localeCompare(b.properties.displayName));
}
function getEvaluationNode(
nodeTypesStore: ReturnType<typeof useNodeTypesStore>,
isEvaluationVariantEnabled: boolean,
) {
const evaluationNodeStore = nodeTypesStore.getNodeType('n8n-nodes-base.evaluation');
if (!isEvaluationVariantEnabled || !evaluationNodeStore) {
return [];
}
const evaluationNode = getNodeView(evaluationNodeStore);
return [
{
...evaluationNode,
properties: {
...evaluationNode.properties,
defaults: {
name: 'Evaluation',
color: '#c3c9d5',
},
},
},
];
}
export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
const i18n = useI18n();
const nodeTypesStore = useNodeTypesStore();
@@ -150,9 +176,7 @@ export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
EVALUATION_TRIGGER.variant,
);
const evaluationNodeStore = nodeTypesStore.getNodeType('n8n-nodes-base.evaluation');
const evaluationNode =
isEvaluationVariantEnabled && evaluationNodeStore ? [getNodeView(evaluationNodeStore)] : [];
const evaluationNode = getEvaluationNode(nodeTypesStore, isEvaluationVariantEnabled);
const chainNodes = getAiNodesBySubcategory(nodeTypesStore.allLatestNodeTypes, AI_CATEGORY_CHAINS);
const agentNodes = getAiNodesBySubcategory(nodeTypesStore.allLatestNodeTypes, AI_CATEGORY_AGENTS);
@@ -358,9 +382,13 @@ export function TriggerView() {
properties: {
group: [],
name: EVALUATION_TRIGGER_NODE_TYPE,
displayName: 'Evaluation Trigger',
displayName: 'When running evaluation',
description: 'Run a dataset through your workflow to test performance',
icon: 'fa:check-double',
defaults: {
name: 'Evaluation',
color: '#c3c9d5',
},
},
}
: null;