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

@@ -11,6 +11,7 @@ export const setOutputProperties: INodeProperties[] = [
},
{
...document,
displayName: 'Document Containing Dataset',
displayOptions: {
show: {
operation: ['setOutputs'],
@@ -19,6 +20,7 @@ export const setOutputProperties: INodeProperties[] = [
},
{
...sheet,
displayName: 'Sheet Containing Dataset',
displayOptions: {
show: {
operation: ['setOutputs'],

View File

@@ -32,6 +32,9 @@ export class Evaluation implements INodeType {
},
inputs: [NodeConnectionTypes.Main],
outputs: `={{(${setOutputs})($parameter)}}`,
codex: {
alias: ['Test', 'Metrics', 'Evals', 'Set Output', 'Set Metrics'],
},
credentials: [
{
name: 'googleApi',

View File

@@ -54,9 +54,10 @@ export class EvaluationTrigger implements INodeType {
authentication,
{
...document,
displayName: 'Document Containing Dataset',
hint: 'Example dataset format <a href="https://docs.google.com/spreadsheets/d/1vD_IdeFUg7sHsK9okL6Doy1rGOkWTnPJV3Dro4FBUsY/edit?gid=0#gid=0">here</a>',
},
sheet,
{ ...sheet, displayName: 'Sheet Containing Dataset' },
{
displayName: 'Limit Rows',
name: 'limitRows',
@@ -76,6 +77,9 @@ export class EvaluationTrigger implements INodeType {
},
readFilter,
],
codex: {
alias: ['Test', 'Metrics', 'Evals', 'Set Output', 'Set Metrics'],
},
credentials: [
{
name: 'googleApi',

View File

@@ -127,7 +127,7 @@ describe('Test Evaluation', () => {
const result = await new Evaluation().execute.call(mockExecuteFunctions);
expect(result).toEqual([]);
expect(result).toEqual([[{ json: {} }]]);
expect(GoogleSheet.prototype.updateRows).not.toBeCalled();

View File

@@ -25,7 +25,7 @@ export async function setOutput(this: IExecuteFunctions): Promise<INodeExecution
message: "No outputs were set since the execution didn't start from an evaluation trigger",
location: 'outputPane',
});
return [];
return [this.getInputData()];
}
const outputFields = this.getNodeParameter('outputs.values', 0, []) as Array<{
@@ -107,12 +107,6 @@ export async function setMetrics(this: IExecuteFunctions): Promise<INodeExecutio
const assignmentValue =
typeof assignment.value === 'number' ? assignment.value : Number(assignment.value);
if (!assignment.name || isNaN(assignmentValue)) {
throw new NodeOperationError(this.getNode(), 'Metric name missing', {
description: 'Make sure each metric you define has a name',
});
}
if (isNaN(assignmentValue)) {
throw new NodeOperationError(
this.getNode(),
@@ -123,6 +117,12 @@ export async function setMetrics(this: IExecuteFunctions): Promise<INodeExecutio
);
}
if (!assignment.name || isNaN(assignmentValue)) {
throw new NodeOperationError(this.getNode(), 'Metric name missing', {
description: 'Make sure each metric you define has a name',
});
}
const { name, value } = validateEntry(
assignment.name,
assignment.type as FieldType,