diff --git a/packages/editor-ui/src/utils/connectionNodeUtils.test.ts b/packages/editor-ui/src/utils/connectionNodeUtils.test.ts index 0dd48f02b2..46010a5e0c 100644 --- a/packages/editor-ui/src/utils/connectionNodeUtils.test.ts +++ b/packages/editor-ui/src/utils/connectionNodeUtils.test.ts @@ -8,7 +8,6 @@ describe('adjustNewlyConnectedNodes', () => { adjustNewlyConnectedNodes(parent, child); expect(child).toEqual({ type: AGENT_NODE_TYPE, - parameters: { promptType: 'define' }, }); }); it('does not modify promptType with ManualTrigger->Agent', () => { @@ -17,24 +16,25 @@ describe('adjustNewlyConnectedNodes', () => { adjustNewlyConnectedNodes(parent, child); expect(child).toEqual({ type: AGENT_NODE_TYPE, + parameters: { promptType: 'define' }, }); }); it('modifies sessionId with ChatTrigger->Memory', () => { const parent = { type: CHAT_TRIGGER_NODE_TYPE }; - const child = { type: 'memoryBufferWindow' }; + const child = { type: '@n8n/n8n-nodes-langchain.memoryBufferWindow' }; adjustNewlyConnectedNodes(parent, child); expect(child).toEqual({ - type: 'memoryBufferWindow', + type: '@n8n/n8n-nodes-langchain.memoryBufferWindow', }); }); it('does not modify sessionId with ManualTrigger->Memory', () => { const parent = { type: MANUAL_TRIGGER_NODE_TYPE }; - const child = { type: 'memoryBufferWindow' }; + const child = { type: '@n8n/n8n-nodes-langchain.memoryBufferWindow' }; adjustNewlyConnectedNodes(parent, child); expect(child).toEqual({ - type: 'memoryBufferWindow', + type: '@n8n/n8n-nodes-langchain.memoryBufferWindow', parameters: { sessionIdType: 'customKey' }, }); }); diff --git a/packages/editor-ui/src/utils/connectionNodeUtils.ts b/packages/editor-ui/src/utils/connectionNodeUtils.ts index 33810f73bf..84f8d91a9a 100644 --- a/packages/editor-ui/src/utils/connectionNodeUtils.ts +++ b/packages/editor-ui/src/utils/connectionNodeUtils.ts @@ -30,12 +30,12 @@ const PROMPT_PROVIDER_NODE_NAMES = [CHAT_TRIGGER_NODE_TYPE]; type NodeWithType = Pick; export function adjustNewlyConnectedNodes(parent: NodeWithType, child: NodeWithType) { - if (!PROMPT_PROVIDER_NODE_NAMES.includes(child.type) && AI_NODES.includes(parent.type)) { + if (!PROMPT_PROVIDER_NODE_NAMES.includes(parent.type) && AI_NODES.includes(child.type)) { Object.assign>(child, { parameters: { promptType: 'define' }, }); } - if (PROMPT_PROVIDER_NODE_NAMES.includes(parent.type) && MEMORY_NODE_NAMES.includes(child.type)) { + if (!PROMPT_PROVIDER_NODE_NAMES.includes(parent.type) && MEMORY_NODE_NAMES.includes(child.type)) { Object.assign>(child, { parameters: { sessionIdType: 'customKey' }, });