wip commit

This commit is contained in:
Charlie Kolb 2024-11-13 15:29:28 +01:00
parent c33b3a3894
commit 5fb8ef9bec
No known key found for this signature in database
3 changed files with 22 additions and 8 deletions

View file

@ -83,7 +83,7 @@ export const promptTypeOptions: INodeProperties = {
description: 'Use an expression to reference data in previous nodes or enter static text',
},
],
default: 'auto',
default: 'define',
};
export const textInput: INodeProperties = {

View file

@ -1116,8 +1116,6 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
return;
}
adjustNewNodes(sourceNode, targetNode, { parentIsNew, childIsNew });
workflowsStore.addConnection({
connection: mappedConnection,
});
@ -1125,6 +1123,7 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
void nextTick(() => {
nodeHelpers.updateNodeInputIssues(sourceNode);
nodeHelpers.updateNodeInputIssues(targetNode);
adjustNewNodes(sourceNode, targetNode, { parentIsNew, childIsNew });
});
if (!keepPristine) {

View file

@ -39,10 +39,25 @@ export function adjustNewNodes(
}
function adjustNewChild(parent: AddedNode, child: AddedNode) {
if (!PROMPT_PROVIDER_NODE_NAMES.includes(parent.type) && AI_NODES.includes(child.type)) {
Object.assign<AddedNode, Partial<INode>>(child, {
parameters: { promptType: 'define' },
});
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, {
parameters: { promptType: 'auto' },
});
}
}
}
@ -52,7 +67,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 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);
if (
!ps.some((x) => PROMPT_PROVIDER_NODE_NAMES.includes(workflow.getNode(x.name)?.type ?? ''))