1
0
Fork 0
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:
Charlie Kolb 2024-11-14 16:57:49 +01:00
parent 0f448102a0
commit e04ae4c82e
No known key found for this signature in database
2 changed files with 11 additions and 17 deletions

View file

@ -28,6 +28,10 @@ describe('adjustNewlyConnectedNodes', () => {
expect(child).toEqual({
type: AGENT_NODE_TYPE,
parameters: {
promptType: 'auto',
text: '={{ $json.chatInput }}',
},
});
});
@ -39,6 +43,10 @@ describe('adjustNewlyConnectedNodes', () => {
expect(child).toEqual({
type: AGENT_NODE_TYPE,
parameters: {
promptType: 'auto',
text: '={{ $json.chatInput }}',
},
});
});
@ -50,7 +58,6 @@ describe('adjustNewlyConnectedNodes', () => {
expect(child).toEqual({
type: AGENT_NODE_TYPE,
parameters: { promptType: 'define' },
});
});

View file

@ -39,23 +39,10 @@ export function adjustNewNodes(
}
function adjustNewChild(parent: AddedNode, child: AddedNode) {
console.log('parent', parent);
console.log('child', child);
if (AI_NODES.includes(child.type)) {
const { getCurrentWorkflow } = useWorkflowsStore();
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 ?? ''),
),
)
) {
if (PROMPT_PROVIDER_NODE_NAMES.includes(parent.type)) {
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 ?? ''))
) {
Object.assign<AddedNode, Partial<INode>>(parent, {
parameters: { sessionIdType: 'customKey' },
parameters: { ...parent.parameters, sessionIdType: 'customKey' },
});
}
}