mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 08:34:07 -08:00
rename and test
This commit is contained in:
parent
70c92760d5
commit
c2a44583c7
|
@ -44,7 +44,7 @@ import { useExternalHooks } from '@/composables/useExternalHooks';
|
|||
import { sortNodeCreateElements, transformNodeType } from '../utils';
|
||||
import { useI18n } from '@/composables/useI18n';
|
||||
import { useCanvasStore } from '@/stores/canvas.store';
|
||||
import { adjustNewlyConnectedNodes } from '@/utils/connectionParameterUtils';
|
||||
import { adjustNewlyConnectedNodes } from '@/utils/connectionNodeUtils';
|
||||
|
||||
export const useActions = () => {
|
||||
const nodeCreatorStore = useNodeCreatorStore();
|
||||
|
|
|
@ -96,7 +96,7 @@ import type { useRouter } from 'vue-router';
|
|||
import { useClipboard } from '@/composables/useClipboard';
|
||||
import { useUniqueNodeName } from '@/composables/useUniqueNodeName';
|
||||
import { isPresent } from '../utils/typesUtils';
|
||||
import { adjustNewlyConnectedNodes } from '@/utils/connectionParameterUtils';
|
||||
import { adjustNewlyConnectedNodes } from '@/utils/connectionNodeUtils';
|
||||
|
||||
type AddNodeData = Partial<INodeUi> & {
|
||||
type: string;
|
||||
|
|
41
packages/editor-ui/src/utils/connectionNodeUtils.test.ts
Normal file
41
packages/editor-ui/src/utils/connectionNodeUtils.test.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
import { AGENT_NODE_TYPE, CHAT_TRIGGER_NODE_TYPE, MANUAL_TRIGGER_NODE_TYPE } from '@/constants';
|
||||
import { adjustNewlyConnectedNodes } from './connectionNodeUtils';
|
||||
|
||||
describe('adjustNewlyConnectedNodes', () => {
|
||||
it('modifies promptType with ChatTrigger->Agent', () => {
|
||||
const parent = { type: CHAT_TRIGGER_NODE_TYPE };
|
||||
const child = { type: AGENT_NODE_TYPE };
|
||||
adjustNewlyConnectedNodes(parent, child);
|
||||
expect(child).toEqual({
|
||||
type: AGENT_NODE_TYPE,
|
||||
parameters: { promptType: 'define' },
|
||||
});
|
||||
});
|
||||
it('does not modify promptType with ManualTrigger->Agent', () => {
|
||||
const parent = { type: MANUAL_TRIGGER_NODE_TYPE };
|
||||
const child = { type: AGENT_NODE_TYPE };
|
||||
adjustNewlyConnectedNodes(parent, child);
|
||||
expect(child).toEqual({
|
||||
type: AGENT_NODE_TYPE,
|
||||
});
|
||||
});
|
||||
|
||||
it('modifies sessionId with ChatTrigger->Memory', () => {
|
||||
const parent = { type: CHAT_TRIGGER_NODE_TYPE };
|
||||
const child = { type: 'memoryBufferWindow' };
|
||||
adjustNewlyConnectedNodes(parent, child);
|
||||
expect(child).toEqual({
|
||||
type: 'memoryBufferWindow',
|
||||
});
|
||||
});
|
||||
|
||||
it('does not modify sessionId with ManualTrigger->Memory', () => {
|
||||
const parent = { type: MANUAL_TRIGGER_NODE_TYPE };
|
||||
const child = { type: 'memoryBufferWindow' };
|
||||
adjustNewlyConnectedNodes(parent, child);
|
||||
expect(child).toEqual({
|
||||
type: 'memoryBufferWindow',
|
||||
parameters: { sessionIdType: 'customKey' },
|
||||
});
|
||||
});
|
||||
});
|
|
@ -17,12 +17,12 @@ const AI_NODES = [
|
|||
];
|
||||
|
||||
const MEMORY_NODE_NAMES = [
|
||||
'memoryBufferWindow',
|
||||
'memoryMotorhead',
|
||||
'memoryPostgresChat',
|
||||
'memoryRedisChat',
|
||||
'memoryXata',
|
||||
'memoryZep',
|
||||
'@n8n/n8n-nodes-langchain.memoryBufferWindow',
|
||||
'@n8n/n8n-nodes-langchain.memoryMotorhead',
|
||||
'@n8n/n8n-nodes-langchain.memoryPostgresChat',
|
||||
'@n8n/n8n-nodes-langchain.memoryRedisChat',
|
||||
'@n8n/n8n-nodes-langchain.memoryXata',
|
||||
'@n8n/n8n-nodes-langchain.memoryZep',
|
||||
];
|
||||
|
||||
const PROMPT_PROVIDER_NODE_NAMES = [CHAT_TRIGGER_NODE_TYPE];
|
Loading…
Reference in a new issue