Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: HumanInput node should unable to paste into container (#34077)

非法操作0e6d97acf941
diff --git a/web/app/components/workflow/hooks/use-nodes-interactions.ts b/web/app/components/workflow/hooks/use-nodes-interactions.ts
index 8de86edecbe..66237b72039 100644
--- a/web/app/components/workflow/hooks/use-nodes-interactions.ts
+++ b/web/app/components/workflow/hooks/use-nodes-interactions.ts
@@ -1820,21 +1820,26 @@ export const useNodesInteractions = () => {
newChildren.push(newLoopStartNode!)
}
else {
- // single node paste
+ // Paste a single regular node. Loop/Iteration nodes are handled above.
const selectedNode = nodes.find(node => node.selected)
let pastedToNestedBlock = false
if (selectedNode) {
+ // Keep this list aligned with availableBlocksFilter(inContainer)
+ // in use-available-blocks.ts.
const commonNestedDisallowPasteNodes = [
- // end node only can be placed outermost layer
BlockEnum.End,
+ BlockEnum.Iteration,
+ BlockEnum.Loop,
+ BlockEnum.DataSource,
+ BlockEnum.KnowledgeBase,
+ BlockEnum.HumanInput,
]
- // handle disallow paste node
if (commonNestedDisallowPasteNodes.includes(nodeToPaste.data.type))
return
- // handle paste to nested block
+ // If a Loop/Iteration container is selected, paste into it as a child.
if (selectedNode.data.type === BlockEnum.Iteration || selectedNode.data.type === BlockEnum.Loop) {
const isIteration = selectedNode.data.type === BlockEnum.Iteration
@@ -1849,10 +1854,10 @@ export const useNodesInteractions = () => {
x: newNode.position.x,
y: newNode.position.y,
}
- // set position base on parent node
+ // Rebase position into the selected container coordinate system.
newNode.position = getNestedNodePosition(newNode, selectedNode)
- // update parent children array like native add
+ // Mirror native add behavior by appending parent._children.
parentChildrenToAppend.push({ parentId: selectedNode.id, childId: newNode.id, childType: newNode.data.type })
pastedToNestedBlock = true