feat(AI Transform Node): UX improvements (#11280)

Co-authored-by: Shireen Missi <94372015+ShireenMissi@users.noreply.github.com>
This commit is contained in:
Michael Kret
2024-11-05 20:47:52 +02:00
committed by GitHub
parent cb28b5cd60
commit 8a484077af
11 changed files with 237 additions and 72 deletions

View File

@@ -5,6 +5,8 @@ import {
type INodeExecutionData,
type INodeType,
type INodeTypeDescription,
AI_TRANSFORM_CODE_GENERATED_FOR_PROMPT,
AI_TRANSFORM_JS_CODE,
} from 'n8n-workflow';
import set from 'lodash/set';
@@ -46,36 +48,29 @@ export class AiTransform implements INodeType {
inputFieldMaxLength: 500,
action: {
type: 'askAiCodeGeneration',
target: 'jsCode',
target: AI_TRANSFORM_JS_CODE,
},
},
},
},
{
displayName: 'Transformation Code',
name: 'jsCode',
displayName: 'Code Generated For Prompt',
name: AI_TRANSFORM_CODE_GENERATED_FOR_PROMPT,
type: 'hidden',
default: '',
},
{
displayName: 'Generated JavaScript',
name: AI_TRANSFORM_JS_CODE,
type: 'string',
typeOptions: {
editor: 'jsEditor',
editorIsReadOnly: true,
},
default: '',
description:
'Read-only. To edit this code, adjust the prompt or copy and paste it into a Code node.',
hint: 'Read-only. To edit this code, adjust the instructions or copy and paste it into a Code node.',
noDataExpression: true,
},
{
displayName:
"Click on 'Test step' to run the transformation code. Further executions will use the generated code (and not invoke AI again).",
name: 'hint',
type: 'notice',
default: '',
displayOptions: {
show: {
jsCode: [{ _cnd: { exists: true } }],
},
},
},
],
};