mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(core): Add support for building LLM applications (#7235)
This extracts all core and editor changes from #7246 and #7137, so that we can get these changes merged first. ADO-1120 [DB Tests](https://github.com/n8n-io/n8n/actions/runs/6379749011) [E2E Tests](https://github.com/n8n-io/n8n/actions/runs/6379751480) [Workflow Tests](https://github.com/n8n-io/n8n/actions/runs/6379752828) --------- Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com> Co-authored-by: Oleg Ivaniv <me@olegivaniv.com> Co-authored-by: Alex Grozav <alex@grozav.com> Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
committed by
GitHub
parent
04dfcd73be
commit
00a4b8b0c6
@@ -565,6 +565,7 @@ export interface IN8nRequestOperationPaginationOffset extends IN8nRequestOperati
|
||||
}
|
||||
|
||||
export interface IGetNodeParameterOptions {
|
||||
contextNode?: INode;
|
||||
// extract value from regex, works only when parameter type is resourceLocator
|
||||
extractValue?: boolean;
|
||||
// get raw value of parameter with unresolved expressions
|
||||
@@ -760,17 +761,37 @@ type BaseExecutionFunctions = FunctionsBaseWithRequiredKeys<'getMode'> & {
|
||||
getInputSourceData(inputIndex?: number, inputName?: string): ISourceData;
|
||||
};
|
||||
|
||||
// TODO: Create later own type only for Config-Nodes
|
||||
export type IExecuteFunctions = ExecuteFunctions.GetNodeParameterFn &
|
||||
BaseExecutionFunctions & {
|
||||
executeWorkflow(
|
||||
workflowInfo: IExecuteWorkflowInfo,
|
||||
inputData?: INodeExecutionData[],
|
||||
): Promise<any>;
|
||||
getInputConnectionData(
|
||||
inputName: ConnectionTypes,
|
||||
itemIndex: number,
|
||||
inputIndex?: number,
|
||||
nodeNameOverride?: string,
|
||||
): Promise<unknown>;
|
||||
getInputData(inputIndex?: number, inputName?: string): INodeExecutionData[];
|
||||
getNodeOutputs(): INodeOutputConfiguration[];
|
||||
putExecutionToWait(waitTill: Date): Promise<void>;
|
||||
sendMessageToUI(message: any): void;
|
||||
sendResponse(response: IExecuteResponsePromiseData): void;
|
||||
|
||||
// TODO: Make this one then only available in the new config one
|
||||
addInputData(
|
||||
connectionType: ConnectionTypes,
|
||||
data: INodeExecutionData[][] | ExecutionError,
|
||||
runIndex?: number,
|
||||
): { index: number };
|
||||
addOutputData(
|
||||
connectionType: ConnectionTypes,
|
||||
currentNodeRunIndex: number,
|
||||
data: INodeExecutionData[][] | ExecutionError,
|
||||
): void;
|
||||
|
||||
nodeHelpers: NodeHelperFunctions;
|
||||
helpers: RequestHelperFunctions &
|
||||
BaseHelperFunctions &
|
||||
@@ -1009,6 +1030,7 @@ export interface INodeParameters {
|
||||
|
||||
export type NodePropertyTypes =
|
||||
| 'boolean'
|
||||
| 'button'
|
||||
| 'collection'
|
||||
| 'color'
|
||||
| 'dateTime'
|
||||
@@ -1049,6 +1071,7 @@ export interface ILoadOptions {
|
||||
}
|
||||
|
||||
export interface INodePropertyTypeOptions {
|
||||
action?: string; // Supported by: button
|
||||
alwaysOpenEditWindow?: boolean; // Supported by: json
|
||||
codeAutocomplete?: CodeAutocompleteTypes; // Supported by: string
|
||||
editor?: EditorType; // Supported by: string
|
||||
@@ -1256,8 +1279,14 @@ export namespace MultiPartFormData {
|
||||
>;
|
||||
}
|
||||
|
||||
export interface SupplyData {
|
||||
metadata?: IDataObject;
|
||||
response: unknown;
|
||||
}
|
||||
|
||||
export interface INodeType {
|
||||
description: INodeTypeDescription;
|
||||
supplyData?(this: IExecuteFunctions): Promise<SupplyData>;
|
||||
execute?(
|
||||
this: IExecuteFunctions,
|
||||
): Promise<INodeExecutionData[][] | NodeExecutionWithMetadata[][] | null>;
|
||||
@@ -1324,7 +1353,7 @@ export interface INodeCredentialDescription {
|
||||
testedBy?: ICredentialTestRequest | string; // Name of a function inside `loadOptions.credentialTest`
|
||||
}
|
||||
|
||||
export type INodeIssueTypes = 'credentials' | 'execution' | 'parameters' | 'typeUnknown';
|
||||
export type INodeIssueTypes = 'credentials' | 'execution' | 'input' | 'parameters' | 'typeUnknown';
|
||||
|
||||
export interface INodeIssueObjectProperty {
|
||||
[key: string]: string[];
|
||||
@@ -1339,6 +1368,7 @@ export interface INodeIssueData {
|
||||
export interface INodeIssues {
|
||||
execution?: boolean;
|
||||
credentials?: INodeIssueObjectProperty;
|
||||
input?: INodeIssueObjectProperty;
|
||||
parameters?: INodeIssueObjectProperty;
|
||||
typeUnknown?: boolean;
|
||||
[key: string]: undefined | boolean | INodeIssueObjectProperty;
|
||||
@@ -1466,15 +1496,77 @@ export interface IPostReceiveSort extends IPostReceiveBase {
|
||||
};
|
||||
}
|
||||
|
||||
export type ConnectionTypes =
|
||||
| 'ai_chain'
|
||||
| 'ai_document'
|
||||
| 'ai_embedding'
|
||||
| 'ai_languageModel'
|
||||
| 'ai_memory'
|
||||
| 'ai_outputParser'
|
||||
| 'ai_retriever'
|
||||
| 'ai_textSplitter'
|
||||
| 'ai_tool'
|
||||
| 'ai_vectorRetriever'
|
||||
| 'ai_vectorStore'
|
||||
| 'main';
|
||||
|
||||
export const enum NodeConnectionType {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
AiChain = 'ai_chain',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
AiDocument = 'ai_document',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
AiEmbedding = 'ai_embedding',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
AiLanguageModel = 'ai_languageModel',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
AiMemory = 'ai_memory',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
AiOutputParser = 'ai_outputParser',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
AiRetriever = 'ai_retriever',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
AiTextSplitter = 'ai_textSplitter',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
AiTool = 'ai_tool',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
AiVectorRetriever = 'ai_vectorRetriever',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
AiVectorStore = 'ai_vectorStore',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
Main = 'main',
|
||||
}
|
||||
|
||||
export interface INodeInputFilter {
|
||||
// TODO: Later add more filter options like categories, subcatogries,
|
||||
// regex, allow to exclude certain nodes, ... ?
|
||||
// Potentially change totally after alpha/beta. Is not a breaking change after all.
|
||||
nodes: string[]; // Allowed nodes
|
||||
}
|
||||
|
||||
export interface INodeInputConfiguration {
|
||||
displayName?: string;
|
||||
maxConnections?: number;
|
||||
required?: boolean;
|
||||
filter?: INodeInputFilter;
|
||||
type: ConnectionTypes;
|
||||
}
|
||||
|
||||
export interface INodeOutputConfiguration {
|
||||
displayName?: string;
|
||||
required?: boolean;
|
||||
type: ConnectionTypes;
|
||||
}
|
||||
|
||||
export interface INodeTypeDescription extends INodeTypeBaseDescription {
|
||||
version: number | number[];
|
||||
defaults: INodeParameters;
|
||||
eventTriggerDescription?: string;
|
||||
activationMessage?: string;
|
||||
inputs: string[];
|
||||
inputs: Array<ConnectionTypes | INodeInputConfiguration> | string;
|
||||
requiredInputs?: string | number[] | number; // Ony available with executionOrder => "v1"
|
||||
inputNames?: string[];
|
||||
outputs: string[];
|
||||
outputs: Array<ConnectionTypes | INodeInputConfiguration> | string;
|
||||
outputNames?: string[];
|
||||
properties: INodeProperties[];
|
||||
credentials?: INodeCredentialDescription[];
|
||||
@@ -1655,6 +1747,10 @@ export interface IRunExecutionData {
|
||||
executionData?: {
|
||||
contextData: IExecuteContextData;
|
||||
nodeExecutionStack: IExecuteData[];
|
||||
metadata: {
|
||||
// node-name: metadata by runIndex
|
||||
[key: string]: ITaskMetadata[];
|
||||
};
|
||||
waitingExecution: IWaitingForExecution;
|
||||
waitingExecutionSource: IWaitingForExecutionSource | null;
|
||||
};
|
||||
@@ -1666,14 +1762,25 @@ export interface IRunData {
|
||||
[key: string]: ITaskData[];
|
||||
}
|
||||
|
||||
export interface ITaskSubRunMetadata {
|
||||
node: string;
|
||||
runIndex: number;
|
||||
}
|
||||
|
||||
export interface ITaskMetadata {
|
||||
subRun?: ITaskSubRunMetadata[];
|
||||
}
|
||||
|
||||
// The data that gets returned when a node runs
|
||||
export interface ITaskData {
|
||||
startTime: number;
|
||||
executionTime: number;
|
||||
executionStatus?: ExecutionStatus;
|
||||
data?: ITaskDataConnections;
|
||||
inputOverride?: ITaskDataConnections;
|
||||
error?: ExecutionError;
|
||||
source: Array<ISourceData | null>; // Is an array as nodes have multiple inputs
|
||||
metadata?: ITaskMetadata;
|
||||
}
|
||||
|
||||
export interface ISourceData {
|
||||
@@ -1769,7 +1876,7 @@ export interface IWorkflowExecuteAdditionalData {
|
||||
restApiUrl: string;
|
||||
instanceBaseUrl: string;
|
||||
setExecutionStatus?: (status: ExecutionStatus) => void;
|
||||
sendMessageToUI?: (source: string, message: any) => void;
|
||||
sendDataToUI?: (type: string, data: IDataObject | IDataObject[]) => void;
|
||||
timezone: string;
|
||||
webhookBaseUrl: string;
|
||||
webhookWaitingBaseUrl: string;
|
||||
@@ -2138,6 +2245,7 @@ export interface IN8nUISettings {
|
||||
urlBaseWebhook: string;
|
||||
urlBaseEditor: string;
|
||||
versionCli: string;
|
||||
isBetaRelease: boolean;
|
||||
n8nMetadata?: {
|
||||
userId?: string;
|
||||
[key: string]: string | number | undefined;
|
||||
|
||||
Reference in New Issue
Block a user