mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
wip commit
This commit is contained in:
parent
c33b3a3894
commit
5fb8ef9bec
|
@ -83,7 +83,7 @@ export const promptTypeOptions: INodeProperties = {
|
||||||
description: 'Use an expression to reference data in previous nodes or enter static text',
|
description: 'Use an expression to reference data in previous nodes or enter static text',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 'auto',
|
default: 'define',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const textInput: INodeProperties = {
|
export const textInput: INodeProperties = {
|
||||||
|
|
|
@ -1116,8 +1116,6 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
adjustNewNodes(sourceNode, targetNode, { parentIsNew, childIsNew });
|
|
||||||
|
|
||||||
workflowsStore.addConnection({
|
workflowsStore.addConnection({
|
||||||
connection: mappedConnection,
|
connection: mappedConnection,
|
||||||
});
|
});
|
||||||
|
@ -1125,6 +1123,7 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||||
void nextTick(() => {
|
void nextTick(() => {
|
||||||
nodeHelpers.updateNodeInputIssues(sourceNode);
|
nodeHelpers.updateNodeInputIssues(sourceNode);
|
||||||
nodeHelpers.updateNodeInputIssues(targetNode);
|
nodeHelpers.updateNodeInputIssues(targetNode);
|
||||||
|
adjustNewNodes(sourceNode, targetNode, { parentIsNew, childIsNew });
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!keepPristine) {
|
if (!keepPristine) {
|
||||||
|
|
|
@ -39,11 +39,26 @@ export function adjustNewNodes(
|
||||||
}
|
}
|
||||||
|
|
||||||
function adjustNewChild(parent: AddedNode, child: AddedNode) {
|
function adjustNewChild(parent: AddedNode, child: AddedNode) {
|
||||||
if (!PROMPT_PROVIDER_NODE_NAMES.includes(parent.type) && AI_NODES.includes(child.type)) {
|
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 ?? ''),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
) {
|
||||||
Object.assign<AddedNode, Partial<INode>>(child, {
|
Object.assign<AddedNode, Partial<INode>>(child, {
|
||||||
parameters: { promptType: 'define' },
|
parameters: { promptType: 'auto' },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function adjustNewParent(parent: AddedNode, child: AddedNode) {
|
function adjustNewParent(parent: AddedNode, child: AddedNode) {
|
||||||
|
@ -52,7 +67,7 @@ function adjustNewParent(parent: AddedNode, child: AddedNode) {
|
||||||
const workflow = getCurrentWorkflow();
|
const workflow = getCurrentWorkflow();
|
||||||
|
|
||||||
// If a memory node is added to an Agent, the memory node is actually the parent since it provides input
|
// 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 there is a prompt provider
|
// So we need to look for the Agent's parents to determine if there is a sessionId provider
|
||||||
const ps = workflow.getParentNodesByDepth(child.name, 1);
|
const ps = workflow.getParentNodesByDepth(child.name, 1);
|
||||||
if (
|
if (
|
||||||
!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 ?? ''))
|
||||||
|
|
Loading…
Reference in a new issue