mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
wip
This commit is contained in:
parent
98ec7370b3
commit
e56a945b9c
|
@ -490,6 +490,7 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
|||
}
|
||||
|
||||
async function addNodes(nodes: AddedNodesAndConnections['nodes'], options: AddNodesOptions = {}) {
|
||||
// here?
|
||||
let insertPosition = options.position;
|
||||
let lastAddedNode: INodeUi | undefined;
|
||||
const addedNodes: INodeUi[] = [];
|
||||
|
|
|
@ -1112,6 +1112,7 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
|
|||
nodeData.type = getCredentialOnlyNodeTypeName(nodeData.extendsCredential);
|
||||
}
|
||||
|
||||
// here?
|
||||
workflow.value.nodes.push(nodeData);
|
||||
// Init node metadata
|
||||
if (!nodeMetadata.value[nodeData.name]) {
|
||||
|
|
|
@ -7,6 +7,8 @@ import {
|
|||
OPEN_AI_NODE_MESSAGE_ASSISTANT_TYPE,
|
||||
QA_CHAIN_NODE_TYPE,
|
||||
} from '@/constants';
|
||||
import { getParentNodes } from '@/components/ButtonParameter/utils';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
|
||||
const AI_NODES = [
|
||||
QA_CHAIN_NODE_TYPE,
|
||||
|
@ -29,14 +31,22 @@ const PROMPT_PROVIDER_NODE_NAMES = [CHAT_TRIGGER_NODE_TYPE];
|
|||
|
||||
type NodeWithType = Pick<INode, 'type'>;
|
||||
|
||||
export function adjustNewlyConnectedNodes(parent: NodeWithType, child: NodeWithType) {
|
||||
const { getCurrentWorkflow, getNodeByName } = useWorkflowsStore();
|
||||
|
||||
export function adjustNewlyConnectedNodes(parent: INode, child: INode) {
|
||||
const workflow = getCurrentWorkflow();
|
||||
|
||||
if (workflow.getParentNodesByDepth(child.name, 1).length > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!PROMPT_PROVIDER_NODE_NAMES.includes(parent.type) && AI_NODES.includes(child.type)) {
|
||||
Object.assign<NodeWithType, Partial<INode>>(child, {
|
||||
Object.assign<INode, Partial<INode>>(child, {
|
||||
parameters: { promptType: 'define' },
|
||||
});
|
||||
}
|
||||
if (!PROMPT_PROVIDER_NODE_NAMES.includes(parent.type) && MEMORY_NODE_NAMES.includes(child.type)) {
|
||||
Object.assign<NodeWithType, Partial<INode>>(child, {
|
||||
Object.assign<INode, Partial<INode>>(child, {
|
||||
parameters: { sessionIdType: 'customKey' },
|
||||
});
|
||||
}
|
||||
|
|
|
@ -867,6 +867,7 @@ async function onAddNodesAndConnections(
|
|||
return;
|
||||
}
|
||||
|
||||
// before here?
|
||||
const addedNodes = await addNodes(nodes, {
|
||||
dragAndDrop,
|
||||
position,
|
||||
|
|
Loading…
Reference in a new issue