mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(core): Update LLM applications building support (no-changelog) (#7710)
extracted out of #7336 --------- 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>
This commit is contained in:
committed by
GitHub
parent
4a89504d54
commit
117962d473
@@ -87,6 +87,7 @@
|
||||
:renaming="renamingActive"
|
||||
:isProductionExecutionPreview="isProductionExecutionPreview"
|
||||
@redrawNode="redrawNode"
|
||||
@switchSelectedNode="onSwitchSelectedNode"
|
||||
@valueChanged="valueChanged"
|
||||
@stopExecution="stopExecution"
|
||||
@saveKeyboardShortcut="onSaveKeyboardShortcut"
|
||||
@@ -356,7 +357,11 @@ import {
|
||||
N8nPlusEndpointType,
|
||||
EVENT_PLUS_ENDPOINT_CLICK,
|
||||
} from '@/plugins/jsplumb/N8nPlusEndpointType';
|
||||
import { EVENT_ADD_INPUT_ENDPOINT_CLICK } from '@/plugins/jsplumb/N8nAddInputEndpointType';
|
||||
import type { N8nAddInputEndpoint } from '@/plugins/jsplumb/N8nAddInputEndpointType';
|
||||
import {
|
||||
EVENT_ADD_INPUT_ENDPOINT_CLICK,
|
||||
N8nAddInputEndpointType,
|
||||
} from '@/plugins/jsplumb/N8nAddInputEndpointType';
|
||||
import { sourceControlEventBus } from '@/event-bus/source-control';
|
||||
import { getConnectorPaintStyleData, OVERLAY_ENDPOINT_ARROW_ID } from '@/utils/nodeViewUtils';
|
||||
import { useViewStacks } from '@/components/Node/NodeCreator/composables/useViewStacks';
|
||||
@@ -788,6 +793,42 @@ export default defineComponent({
|
||||
});
|
||||
|
||||
await this.runWorkflow({});
|
||||
this.refreshEndpointsErrorsState();
|
||||
},
|
||||
resetEndpointsErrors() {
|
||||
const allEndpoints = Object.values(this.instance.getManagedElements()).flatMap(
|
||||
(el) => el.endpoints,
|
||||
);
|
||||
|
||||
allEndpoints
|
||||
.filter((endpoint) => endpoint?.endpoint.type === N8nAddInputEndpointType)
|
||||
.forEach((endpoint) => {
|
||||
const n8nAddInputEndpoint = endpoint?.endpoint as N8nAddInputEndpoint;
|
||||
if (n8nAddInputEndpoint && (endpoint?.connections ?? []).length > 0) {
|
||||
n8nAddInputEndpoint.resetError();
|
||||
}
|
||||
});
|
||||
},
|
||||
refreshEndpointsErrorsState() {
|
||||
const nodeIssues = this.workflowsStore.allNodes.filter((n) => n.issues);
|
||||
// Set input color to red if there are issues
|
||||
this.resetEndpointsErrors();
|
||||
nodeIssues.forEach((node) => {
|
||||
const managedNode = this.instance.getManagedElement(node.id);
|
||||
const endpoints = this.instance.getEndpoints(managedNode);
|
||||
|
||||
Object.keys(node?.issues?.input ?? {}).forEach((connectionType) => {
|
||||
const inputEndpointsWithIssues = endpoints.filter(
|
||||
(e) => e._defaultType.scope === connectionType,
|
||||
);
|
||||
inputEndpointsWithIssues.forEach((endpoint) => {
|
||||
const n8nAddInputEndpoint = endpoint?.endpoint as N8nAddInputEndpoint;
|
||||
if (n8nAddInputEndpoint) {
|
||||
n8nAddInputEndpoint.setError();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
onRunContainerClick() {
|
||||
if (this.containsTrigger && !this.allTriggersDisabled) return;
|
||||
@@ -2398,36 +2439,21 @@ export default defineComponent({
|
||||
}
|
||||
this.historyStore.stopRecordingUndo();
|
||||
},
|
||||
insertNodeAfterSelected(info: {
|
||||
sourceId: string;
|
||||
index: number;
|
||||
eventSource: NodeCreatorOpenSource;
|
||||
connection?: Connection;
|
||||
nodeCreatorView?: string;
|
||||
outputType?: NodeConnectionType;
|
||||
endpointUuid?: string;
|
||||
}) {
|
||||
const type = info.outputType || NodeConnectionType.Main;
|
||||
|
||||
getNodeCreatorFilter(nodeName: string, outputType?: NodeConnectionType) {
|
||||
let filter;
|
||||
// Get the node and set it as active that new nodes
|
||||
// which get created get automatically connected
|
||||
// to it.
|
||||
const sourceNode = this.workflowsStore.getNodeById(info.sourceId);
|
||||
if (!sourceNode) {
|
||||
return;
|
||||
}
|
||||
|
||||
const workflow = this.getCurrentWorkflow();
|
||||
const workflowNode = workflow.getNode(nodeName);
|
||||
if (!workflowNode) return { nodes: [] };
|
||||
|
||||
const nodeType = this.nodeTypesStore.getNodeType(sourceNode.type, sourceNode.typeVersion);
|
||||
|
||||
const nodeType = this.nodeTypesStore.getNodeType(
|
||||
workflowNode?.type,
|
||||
workflowNode.typeVersion,
|
||||
);
|
||||
if (nodeType) {
|
||||
const workflowNode = workflow.getNode(sourceNode.name);
|
||||
const inputs = NodeHelpers.getNodeInputs(workflow, workflowNode!, nodeType);
|
||||
const inputs = NodeHelpers.getNodeInputs(workflow, workflowNode, nodeType);
|
||||
|
||||
const filterFound = inputs.filter((input) => {
|
||||
if (typeof input === 'string' || input.type !== info.outputType || !input.filter) {
|
||||
if (typeof input === 'string' || input.type !== outputType || !input.filter) {
|
||||
// No filters defined or wrong connection type
|
||||
return false;
|
||||
}
|
||||
@@ -2440,6 +2466,26 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
return filter;
|
||||
},
|
||||
insertNodeAfterSelected(info: {
|
||||
sourceId: string;
|
||||
index: number;
|
||||
eventSource: NodeCreatorOpenSource;
|
||||
connection?: Connection;
|
||||
nodeCreatorView?: string;
|
||||
outputType?: NodeConnectionType;
|
||||
endpointUuid?: string;
|
||||
}) {
|
||||
const type = info.outputType ?? NodeConnectionType.Main;
|
||||
// Get the node and set it as active that new nodes
|
||||
// which get created get automatically connected
|
||||
// to it.
|
||||
const sourceNode = this.workflowsStore.getNodeById(info.sourceId);
|
||||
if (!sourceNode) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.uiStore.lastSelectedNode = sourceNode.name;
|
||||
this.uiStore.lastSelectedNodeEndpointUuid =
|
||||
info.endpointUuid ?? info.connection?.target.jtk?.endpoint.uuid;
|
||||
@@ -2464,7 +2510,11 @@ export default defineComponent({
|
||||
|
||||
if (isScopedConnection) {
|
||||
useViewStacks()
|
||||
.gotoCompatibleConnectionView(type, isOutput, filter)
|
||||
.gotoCompatibleConnectionView(
|
||||
type,
|
||||
isOutput,
|
||||
this.getNodeCreatorFilter(sourceNode.name, type),
|
||||
)
|
||||
.catch((e) => {});
|
||||
}
|
||||
},
|
||||
@@ -2688,7 +2738,8 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
this.dropPrevented = false;
|
||||
void this.updateNodesInputIssues();
|
||||
this.updateNodesInputIssues();
|
||||
this.resetEndpointsErrors();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
@@ -3616,6 +3667,9 @@ export default defineComponent({
|
||||
}, recordingTimeout);
|
||||
}
|
||||
},
|
||||
async onSwitchSelectedNode(nodeName: string) {
|
||||
this.nodeSelectedByName(nodeName, true, true);
|
||||
},
|
||||
async redrawNode(nodeName: string) {
|
||||
// TODO: Improve later
|
||||
// For now we redraw the node by simply renaming it. Can for sure be
|
||||
@@ -4617,6 +4671,37 @@ export default defineComponent({
|
||||
|
||||
sourceControlEventBus.on('pull', this.onSourceControlPull);
|
||||
|
||||
this.registerCustomAction({
|
||||
key: 'openNodeDetail',
|
||||
action: ({ node }: { node: string }) => {
|
||||
this.nodeSelectedByName(node, true);
|
||||
},
|
||||
});
|
||||
|
||||
this.registerCustomAction({
|
||||
key: 'openSelectiveNodeCreator',
|
||||
action: ({ connectiontype, node }: { connectiontype: NodeConnectionType; node: string }) => {
|
||||
this.onToggleNodeCreator({
|
||||
source: NODE_CREATOR_OPEN_SOURCES.NOTICE_ERROR_MESSAGE,
|
||||
createNodeActive: true,
|
||||
nodeCreatorView: AI_NODE_CREATOR_VIEW,
|
||||
});
|
||||
|
||||
this.ndvStore.activeNodeName = null;
|
||||
// Select the node so that the node creator knows which node to connect to
|
||||
const nodeData = this.workflowsStore.getNodeByName(node);
|
||||
if (connectiontype && nodeData) {
|
||||
this.insertNodeAfterSelected({
|
||||
index: 0,
|
||||
endpointUuid: `${nodeData.id}-input${connectiontype}0`,
|
||||
eventSource: NODE_CREATOR_OPEN_SOURCES.NOTICE_ERROR_MESSAGE,
|
||||
outputType: connectiontype,
|
||||
sourceId: nodeData.id,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
this.readOnlyEnvRouteCheck();
|
||||
},
|
||||
activated() {
|
||||
@@ -4684,6 +4769,8 @@ export default defineComponent({
|
||||
document.removeEventListener('keydown', this.keyDown);
|
||||
document.removeEventListener('keyup', this.keyUp);
|
||||
this.unregisterCustomAction('showNodeCreator');
|
||||
this.unregisterCustomAction('openNodeDetail');
|
||||
this.unregisterCustomAction('openSelectiveNodeCreator');
|
||||
|
||||
if (!this.isDemo) {
|
||||
this.pushStore.pushDisconnect();
|
||||
|
||||
Reference in New Issue
Block a user