feat(AI Transform Node): New node (#10405)

Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
Co-authored-by: Shireen Missi <94372015+ShireenMissi@users.noreply.github.com>
This commit is contained in:
Michael Kret
2024-08-14 16:20:02 +03:00
committed by GitHub
parent 5ed2a77740
commit 4d222ac19d
24 changed files with 839 additions and 39 deletions

View File

@@ -37,6 +37,7 @@ export const CODE_NODE_TYPE = 'n8n-nodes-base.code';
export const FUNCTION_NODE_TYPE = 'n8n-nodes-base.function';
export const FUNCTION_ITEM_NODE_TYPE = 'n8n-nodes-base.functionItem';
export const MERGE_NODE_TYPE = 'n8n-nodes-base.merge';
export const AI_TRANSFORM_NODE_TYPE = 'n8n-nodes-base.aiTransform';
export const STARTING_NODE_TYPES = [
MANUAL_TRIGGER_NODE_TYPE,
@@ -45,7 +46,12 @@ export const STARTING_NODE_TYPES = [
START_NODE_TYPE,
];
export const SCRIPTING_NODE_TYPES = [FUNCTION_NODE_TYPE, FUNCTION_ITEM_NODE_TYPE, CODE_NODE_TYPE];
export const SCRIPTING_NODE_TYPES = [
FUNCTION_NODE_TYPE,
FUNCTION_ITEM_NODE_TYPE,
CODE_NODE_TYPE,
AI_TRANSFORM_NODE_TYPE,
];
/**
* Nodes whose parameter values may refer to other nodes without expressions.
@@ -55,6 +61,7 @@ export const NODES_WITH_RENAMABLE_CONTENT = new Set([
CODE_NODE_TYPE,
FUNCTION_NODE_TYPE,
FUNCTION_ITEM_NODE_TYPE,
AI_TRANSFORM_NODE_TYPE,
]);
//@n8n/n8n-nodes-langchain

View File

@@ -1229,12 +1229,25 @@ export interface ILoadOptions {
};
}
export type NodePropertyAction = {
type: 'askAiCodeGeneration';
handler?: string;
target?: string;
};
export interface INodePropertyTypeOptions {
action?: string; // Supported by: button
// Supported by: button
buttonConfig?: {
action?: string | NodePropertyAction;
label?: string; // otherwise "displayName" is used
hasInputField?: boolean;
inputFieldMaxLength?: number; // Supported if hasInputField is true
};
containerClass?: string; // Supported by: notice
alwaysOpenEditWindow?: boolean; // Supported by: json
codeAutocomplete?: CodeAutocompleteTypes; // Supported by: string
editor?: EditorType; // Supported by: string
editorIsReadOnly?: boolean; // Supported by: string
sqlDialect?: SQLDialect; // Supported by: sqlEditor
loadOptionsDependsOn?: string[]; // Supported by: options
loadOptionsMethod?: string; // Supported by: options
@@ -1526,6 +1539,12 @@ export interface INodeType {
resourceMapping?: {
[functionName: string]: (this: ILoadOptionsFunctions) => Promise<ResourceMapperFields>;
};
actionHandler?: {
[functionName: string]: (
this: ILoadOptionsFunctions,
payload: IDataObject | string | undefined,
) => Promise<NodeParameterValueType>;
};
};
webhookMethods?: {
[name in IWebhookDescription['name']]?: {