mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 00:24:07 -08:00
Fix tests
This commit is contained in:
parent
21f126cc46
commit
98ec7370b3
|
@ -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' },
|
||||
});
|
||||
});
|
||||
|
|
|
@ -30,12 +30,12 @@ const PROMPT_PROVIDER_NODE_NAMES = [CHAT_TRIGGER_NODE_TYPE];
|
|||
type NodeWithType = Pick<INode, 'type'>;
|
||||
|
||||
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<NodeWithType, Partial<INode>>(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<NodeWithType, Partial<INode>>(child, {
|
||||
parameters: { sessionIdType: 'customKey' },
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue