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
@@ -40,7 +40,7 @@ import type {
|
||||
IWorkflowDataProxyAdditionalKeys,
|
||||
Workflow,
|
||||
} from 'n8n-workflow';
|
||||
import { WorkflowDataProxy } from 'n8n-workflow';
|
||||
import { NodeConnectionType, WorkflowDataProxy } from 'n8n-workflow';
|
||||
|
||||
import VariableSelectorItem from '@/components/VariableSelectorItem.vue';
|
||||
import type { INodeUi, IVariableItemSelected, IVariableSelectorOption } from '@/Interface';
|
||||
@@ -69,6 +69,13 @@ export default defineComponent({
|
||||
},
|
||||
computed: {
|
||||
...mapStores(useNDVStore, useRootStore, useWorkflowsStore),
|
||||
activeNode(): INodeUi | null {
|
||||
const activeNode = this.ndvStore.activeNode!;
|
||||
if (!activeNode) {
|
||||
return null;
|
||||
}
|
||||
return this.getParentMainInputNode(this.getCurrentWorkflow(), activeNode);
|
||||
},
|
||||
extendAll(): boolean {
|
||||
if (this.variableFilter) {
|
||||
return true;
|
||||
@@ -290,7 +297,7 @@ export default defineComponent({
|
||||
* @param {string} filterText Filter text for parameters
|
||||
* @param {number} [itemIndex=0] The index of the item
|
||||
* @param {number} [runIndex=0] The index of the run
|
||||
* @param {string} [inputName='main'] The name of the input
|
||||
* @param {string} [inputName=NodeConnectionType.Main] The name of the input
|
||||
* @param {number} [outputIndex=0] The index of the output
|
||||
* @param {boolean} [useShort=false] Use short notation $json vs. $('NodeName').json
|
||||
*/
|
||||
@@ -300,7 +307,7 @@ export default defineComponent({
|
||||
filterText: string,
|
||||
itemIndex = 0,
|
||||
runIndex = 0,
|
||||
inputName = 'main',
|
||||
inputName = NodeConnectionType.Main,
|
||||
outputIndex = 0,
|
||||
useShort = false,
|
||||
): IVariableSelectorOption[] | null {
|
||||
@@ -462,20 +469,18 @@ export default defineComponent({
|
||||
filterText: string,
|
||||
): IVariableSelectorOption[] | null {
|
||||
const itemIndex = 0;
|
||||
const inputName = 'main';
|
||||
const inputName = NodeConnectionType.Main;
|
||||
const runIndex = 0;
|
||||
const returnData: IVariableSelectorOption[] = [];
|
||||
|
||||
const activeNode: INodeUi | null = this.ndvStore.activeNode;
|
||||
|
||||
if (activeNode === null) {
|
||||
if (this.activeNode === null) {
|
||||
return returnData;
|
||||
}
|
||||
|
||||
const nodeConnection = this.workflow.getNodeConnectionIndexes(
|
||||
activeNode.name,
|
||||
this.activeNode.name,
|
||||
parentNode[0],
|
||||
'main',
|
||||
inputName,
|
||||
);
|
||||
const connectionInputData = this.connectionInputData(
|
||||
parentNode,
|
||||
@@ -581,16 +586,15 @@ export default defineComponent({
|
||||
return returnParameters;
|
||||
},
|
||||
getFilterResults(filterText: string, itemIndex: number): IVariableSelectorOption[] {
|
||||
const inputName = 'main';
|
||||
const inputName = NodeConnectionType.Main;
|
||||
|
||||
const activeNode: INodeUi | null = this.ndvStore.activeNode;
|
||||
|
||||
if (activeNode === null) {
|
||||
if (this.activeNode === null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const executionData = this.workflowsStore.getWorkflowExecution;
|
||||
let parentNode = this.workflow.getParentNodes(activeNode.name, inputName, 1);
|
||||
let parentNode = this.workflow.getParentNodes(this.activeNode.name, inputName, 1);
|
||||
console.log('parentNode', parentNode);
|
||||
let runData = this.workflowsStore.getWorkflowRunData;
|
||||
|
||||
if (runData === null) {
|
||||
@@ -614,7 +618,7 @@ export default defineComponent({
|
||||
this.workflow,
|
||||
runExecutionData,
|
||||
parentNode,
|
||||
activeNode.name,
|
||||
this.activeNode.name,
|
||||
filterText,
|
||||
) as IVariableSelectorOption[];
|
||||
if (tempOptions.length) {
|
||||
@@ -630,17 +634,23 @@ export default defineComponent({
|
||||
if (parentNode.length) {
|
||||
// If the node has an input node add the input data
|
||||
|
||||
const activeInputParentNode = parentNode.find(
|
||||
(node) => node === this.ndvStore.ndvInputNodeName,
|
||||
)!;
|
||||
let ndvInputNodeName = this.ndvStore.ndvInputNodeName;
|
||||
if (!ndvInputNodeName) {
|
||||
// If no input node is set use the first parent one
|
||||
// this is imporant for config-nodes which do not have
|
||||
// a main input
|
||||
ndvInputNodeName = parentNode[0];
|
||||
}
|
||||
|
||||
const activeInputParentNode = parentNode.find((node) => node === ndvInputNodeName)!;
|
||||
|
||||
// Check from which output to read the data.
|
||||
// Depends on how the nodes are connected.
|
||||
// (example "IF" node. If node is connected to "true" or to "false" output)
|
||||
const nodeConnection = this.workflow.getNodeConnectionIndexes(
|
||||
activeNode.name,
|
||||
this.activeNode.name,
|
||||
activeInputParentNode,
|
||||
'main',
|
||||
inputName,
|
||||
);
|
||||
const outputIndex = nodeConnection === undefined ? 0 : nodeConnection.sourceIndex;
|
||||
|
||||
@@ -650,7 +660,7 @@ export default defineComponent({
|
||||
filterText,
|
||||
itemIndex,
|
||||
0,
|
||||
'main',
|
||||
inputName,
|
||||
outputIndex,
|
||||
true,
|
||||
) as IVariableSelectorOption[];
|
||||
@@ -731,7 +741,7 @@ export default defineComponent({
|
||||
name: this.$locale.baseText('variableSelector.parameters'),
|
||||
options: this.sortOptions(
|
||||
this.getNodeParameters(
|
||||
activeNode.name,
|
||||
this.activeNode.name,
|
||||
initialPath,
|
||||
skipParameter,
|
||||
filterText,
|
||||
@@ -751,7 +761,7 @@ export default defineComponent({
|
||||
// -----------------------------------------
|
||||
const allNodesData: IVariableSelectorOption[] = [];
|
||||
let nodeOptions: IVariableSelectorOption[];
|
||||
const upstreamNodes = this.workflow.getParentNodes(activeNode.name, inputName);
|
||||
const upstreamNodes = this.workflow.getParentNodes(this.activeNode.name, inputName);
|
||||
|
||||
const workflowNodes = Object.entries(this.workflow.nodes);
|
||||
|
||||
@@ -764,7 +774,7 @@ export default defineComponent({
|
||||
// Add the parameters of all nodes
|
||||
// TODO: Later have to make sure that no parameters can be referenced which have expression which use input-data (for nodes which are not parent nodes)
|
||||
|
||||
if (nodeName === activeNode.name) {
|
||||
if (nodeName === this.activeNode.name) {
|
||||
// Skip the current node as this one get added separately
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user