mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 08:34:07 -08:00
self review
This commit is contained in:
parent
a1cf28dce9
commit
738aee4d46
|
@ -1112,7 +1112,6 @@ 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]) {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { AGENT_NODE_TYPE, CHAT_TRIGGER_NODE_TYPE, MANUAL_TRIGGER_NODE_TYPE } from '@/constants';
|
||||
import { adjustNewNodes } from '@/utils/connectionNodeUtils';
|
||||
import { createPinia, setActivePinia } from 'pinia';
|
||||
|
@ -24,7 +23,9 @@ describe('adjustNewlyConnectedNodes', () => {
|
|||
it('modifies promptType with ChatTrigger->new Agent', () => {
|
||||
const parent = { type: CHAT_TRIGGER_NODE_TYPE };
|
||||
const child = { type: AGENT_NODE_TYPE };
|
||||
|
||||
adjustNewNodes(parent, child, { parentIsNew: false });
|
||||
|
||||
expect(child).toEqual({
|
||||
type: AGENT_NODE_TYPE,
|
||||
});
|
||||
|
@ -33,7 +34,9 @@ describe('adjustNewlyConnectedNodes', () => {
|
|||
it('modifies promptType with new ChatTrigger->new Agent', () => {
|
||||
const parent = { type: CHAT_TRIGGER_NODE_TYPE };
|
||||
const child = { type: AGENT_NODE_TYPE };
|
||||
|
||||
adjustNewNodes(parent, child);
|
||||
|
||||
expect(child).toEqual({
|
||||
type: AGENT_NODE_TYPE,
|
||||
});
|
||||
|
@ -42,7 +45,9 @@ describe('adjustNewlyConnectedNodes', () => {
|
|||
it('does not modify promptType with ManualTrigger->new Agent', () => {
|
||||
const parent = { type: MANUAL_TRIGGER_NODE_TYPE };
|
||||
const child = { type: AGENT_NODE_TYPE };
|
||||
|
||||
adjustNewNodes(parent, child, { parentIsNew: false });
|
||||
|
||||
expect(child).toEqual({
|
||||
type: AGENT_NODE_TYPE,
|
||||
parameters: { promptType: 'define' },
|
||||
|
@ -56,7 +61,9 @@ describe('adjustNewlyConnectedNodes', () => {
|
|||
|
||||
const child = { type: AGENT_NODE_TYPE };
|
||||
const parent = { type: '@n8n/n8n-nodes-langchain.memoryBufferWindow' };
|
||||
|
||||
adjustNewNodes(parent, child, { childIsNew: false });
|
||||
|
||||
expect(parent).toEqual({
|
||||
type: '@n8n/n8n-nodes-langchain.memoryBufferWindow',
|
||||
});
|
||||
|
@ -69,7 +76,9 @@ describe('adjustNewlyConnectedNodes', () => {
|
|||
|
||||
const child = { type: AGENT_NODE_TYPE, name: 'myAgent' };
|
||||
const parent = { type: '@n8n/n8n-nodes-langchain.memoryBufferWindow' };
|
||||
|
||||
adjustNewNodes(parent, child, { childIsNew: false });
|
||||
|
||||
expect(parent).toEqual({
|
||||
type: '@n8n/n8n-nodes-langchain.memoryBufferWindow',
|
||||
parameters: { sessionIdType: 'customKey' },
|
||||
|
|
|
@ -52,7 +52,7 @@ function adjustNewParent(parent: AddedNode, child: AddedNode) {
|
|||
const workflow = getCurrentWorkflow();
|
||||
|
||||
// If a memory node is added to an Agent, the memory node is actually the parent since it provides input
|
||||
// So we need to look for the Agent's parents to determine if it's a prompt provider
|
||||
// So we need to look for the Agent's parents to determine if there is a prompt provider
|
||||
const ps = workflow.getParentNodesByDepth(child.name, 1);
|
||||
if (
|
||||
!ps.some((x) => PROMPT_PROVIDER_NODE_NAMES.includes(workflow.getNode(x.name)?.type ?? ''))
|
||||
|
|
|
@ -867,7 +867,6 @@ async function onAddNodesAndConnections(
|
|||
return;
|
||||
}
|
||||
|
||||
// before here?
|
||||
const addedNodes = await addNodes(nodes, {
|
||||
dragAndDrop,
|
||||
position,
|
||||
|
|
Loading…
Reference in a new issue