mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Support disabled field
This commit is contained in:
parent
0f448102a0
commit
e04ae4c82e
|
@ -28,6 +28,10 @@ describe('adjustNewlyConnectedNodes', () => {
|
||||||
|
|
||||||
expect(child).toEqual({
|
expect(child).toEqual({
|
||||||
type: AGENT_NODE_TYPE,
|
type: AGENT_NODE_TYPE,
|
||||||
|
parameters: {
|
||||||
|
promptType: 'auto',
|
||||||
|
text: '={{ $json.chatInput }}',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -39,6 +43,10 @@ describe('adjustNewlyConnectedNodes', () => {
|
||||||
|
|
||||||
expect(child).toEqual({
|
expect(child).toEqual({
|
||||||
type: AGENT_NODE_TYPE,
|
type: AGENT_NODE_TYPE,
|
||||||
|
parameters: {
|
||||||
|
promptType: 'auto',
|
||||||
|
text: '={{ $json.chatInput }}',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -50,7 +58,6 @@ describe('adjustNewlyConnectedNodes', () => {
|
||||||
|
|
||||||
expect(child).toEqual({
|
expect(child).toEqual({
|
||||||
type: AGENT_NODE_TYPE,
|
type: AGENT_NODE_TYPE,
|
||||||
parameters: { promptType: 'define' },
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -39,23 +39,10 @@ export function adjustNewNodes(
|
||||||
}
|
}
|
||||||
|
|
||||||
function adjustNewChild(parent: AddedNode, child: AddedNode) {
|
function adjustNewChild(parent: AddedNode, child: AddedNode) {
|
||||||
console.log('parent', parent);
|
|
||||||
console.log('child', child);
|
|
||||||
if (AI_NODES.includes(child.type)) {
|
if (AI_NODES.includes(child.type)) {
|
||||||
const { getCurrentWorkflow } = useWorkflowsStore();
|
if (PROMPT_PROVIDER_NODE_NAMES.includes(parent.type)) {
|
||||||
const workflow = getCurrentWorkflow();
|
|
||||||
|
|
||||||
const ps = [parent, ...(child.name ? workflow.getParentNodesByDepth(child.name, 1) : [])];
|
|
||||||
console.log('parents', ps);
|
|
||||||
if (
|
|
||||||
ps.some((x) =>
|
|
||||||
PROMPT_PROVIDER_NODE_NAMES.includes(
|
|
||||||
'type' in x ? x.type : (workflow.getNode(x?.name ?? '')?.type ?? ''),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
Object.assign<AddedNode, Partial<INode>>(child, {
|
Object.assign<AddedNode, Partial<INode>>(child, {
|
||||||
parameters: { ...child.parameters, promptType: 'auto' },
|
parameters: { ...child.parameters, promptType: 'auto', text: '={{ $json.chatInput }}' },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +60,7 @@ function adjustNewParent(parent: AddedNode, child: AddedNode) {
|
||||||
!ps.some((x) => PROMPT_PROVIDER_NODE_NAMES.includes(workflow.getNode(x.name)?.type ?? ''))
|
!ps.some((x) => PROMPT_PROVIDER_NODE_NAMES.includes(workflow.getNode(x.name)?.type ?? ''))
|
||||||
) {
|
) {
|
||||||
Object.assign<AddedNode, Partial<INode>>(parent, {
|
Object.assign<AddedNode, Partial<INode>>(parent, {
|
||||||
parameters: { sessionIdType: 'customKey' },
|
parameters: { ...parent.parameters, sessionIdType: 'customKey' },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue