feat(editor): Auto-add LLM chain for new LLM nodes on empty canvas (#10245)

Co-authored-by: JP van Oosten <jp@n8n.io>
This commit is contained in:
oleg
2024-08-05 13:59:02 +02:00
committed by GitHub
parent 42a0b594d6
commit 06419d9483
21 changed files with 94 additions and 25 deletions

View File

@@ -610,7 +610,7 @@ export default defineComponent({
return this.workflowsStore.getWorkflowExecution;
},
workflowRunning(): boolean {
return this.uiStore.isActionActive['workflowRunning'];
return this.uiStore.isActionActive.workflowRunning;
},
currentWorkflow(): string {
return this.$route.params.name?.toString() || this.workflowsStore.workflowId;
@@ -4428,7 +4428,7 @@ export default defineComponent({
from.outputIndex ?? 0,
toNode.name,
to.inputIndex ?? 0,
NodeConnectionType.Main,
from.type ?? NodeConnectionType.Main,
);
}
@@ -4449,6 +4449,22 @@ export default defineComponent({
});
}
const lastNodeType = this.nodeTypesStore.getNodeType(lastAddedNode.type);
const isSubNode = NodeHelpers.isSubNodeType(lastNodeType);
// When adding a sub-node and there's more than one node added at the time, it must mean that it's
// connected to a root node, so we adjust the position of the sub-node to make it appear in the correct
// in relation to the root node
if (isSubNode && nodes.length > 1) {
this.onMoveNode({
nodeName: lastAddedNode.name,
position: [
lastAddedNode.position[0] - NodeViewUtils.NODE_SIZE * 2.5,
lastAddedNode.position[1] + NodeViewUtils.NODE_SIZE * 1.5,
],
});
}
this.nodeHelpers.addPinDataConnections(this.workflowsStore.pinnedWorkflowData);
},