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:
कारतोफ्फेलस्क्रिप्ट™
2023-10-02 17:33:43 +02:00
committed by GitHub
parent 04dfcd73be
commit 00a4b8b0c6
93 changed files with 6209 additions and 728 deletions

View File

@@ -36,6 +36,10 @@ import type {
INodePropertyOptions,
ResourceMapperValue,
ValidationResult,
ConnectionTypes,
INodeTypeDescription,
INodeOutputConfiguration,
INodeInputConfiguration,
GenericValue,
} from './Interfaces';
import { isResourceMapperValue, isValidResourceLocatorParameterValue } from './type-guards';
@@ -1005,6 +1009,65 @@ export function getNodeWebhookUrl(
return `${baseUrl}/${getNodeWebhookPath(workflowId, node, path, isFullPath)}`;
}
export function getConnectionTypes(
connections: Array<ConnectionTypes | INodeInputConfiguration | INodeOutputConfiguration>,
): ConnectionTypes[] {
return connections
.map((connection) => {
if (typeof connection === 'string') {
return connection;
}
return connection.type;
})
.filter((connection) => connection !== undefined);
}
export function getNodeInputs(
workflow: Workflow,
node: INode,
nodeTypeData: INodeTypeDescription,
): Array<ConnectionTypes | INodeInputConfiguration> {
if (Array.isArray(nodeTypeData.inputs)) {
return nodeTypeData.inputs;
}
// Calculate the outputs dynamically
try {
return (workflow.expression.getSimpleParameterValue(
node,
nodeTypeData.inputs,
'internal',
'',
{},
) || []) as ConnectionTypes[];
} catch (e) {
throw new Error(`Could not calculate inputs dynamically for node "${node.name}"`);
}
}
export function getNodeOutputs(
workflow: Workflow,
node: INode,
nodeTypeData: INodeTypeDescription,
): Array<ConnectionTypes | INodeOutputConfiguration> {
if (Array.isArray(nodeTypeData.outputs)) {
return nodeTypeData.outputs;
}
// Calculate the outputs dynamically
try {
return (workflow.expression.getSimpleParameterValue(
node,
nodeTypeData.outputs,
'internal',
'',
{},
) || []) as ConnectionTypes[];
} catch (e) {
throw new Error(`Could not calculate outputs dynamically for node "${node.name}"`);
}
}
/**
* Returns all the parameter-issues of the node
*
@@ -1049,7 +1112,7 @@ export function nodeIssuesToString(issues: INodeIssues, node?: INode): string[]
nodeIssues.push('Execution Error.');
}
const objectProperties = ['parameters', 'credentials'];
const objectProperties = ['parameters', 'credentials', 'input'];
let issueText: string;
let parameterName: string;