From f2c634ff38c75b70642ccf176ad4f75b91bdad0f Mon Sep 17 00:00:00 2001 From: qiqi Date: Tue, 17 Nov 2026 17:02:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(canvas):=20=E6=B2=A1=E6=9C=89=E4=B8=8A?= =?UTF-8?q?=E6=B8=B8=E6=A0=B7=E5=BC=8F=E8=8A=82=E7=82=B9=E7=9A=84=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E8=AF=8D/=E6=96=87=E6=9C=AC=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E6=98=BE=E7=A4=BA=E3=80=8C=E5=B7=B2=E5=9B=BA?= =?UTF-8?q?=E5=AE=9A=20/=20=E6=81=A2=E5=A4=8D=E8=B7=9F=E9=9A=8F=E3=80=8D?= =?UTF-8?q?=EF=BC=88=E9=81=BF=E5=85=8D=E8=AF=AF=E7=82=B9=E6=B8=85=E7=A9=BA?= =?UTF-8?q?=E6=89=8B=E5=86=99=E6=96=87=E6=A1=88=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 13 ++++++++++--- src/ui-node-bodies.js | 3 +++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 393c726..d94c16c 100644 --- a/app.js +++ b/app.js @@ -3488,9 +3488,16 @@ // 为空 = 跟随上游,节点体把上游文本显示出来(改一个字就落进自己的 data.text)。 function nodeInheritOf(node, nodesArr, edgesArr) { const own = String((node && node.data && node.data.text) || '').trim() - if (own) return { text: '', sourceNodeId: '', more: 0, own: true } - const info = inheritedTextOf(node && node.id, nodesArr, edgesArr) - return { text: String(info.text || ''), sourceNodeId: String(info.sourceNodeId || ''), more: Number(info.more) || 0, own: false } + // 关键:先查上游。没有上游就根本没有「继承/已固定」这回事(用户是纯手写) + const info = inheritedTextOf(node && node.id, nodesArr, edgesArr) || {} + const hasUpstream = !!(info.sourceNodeId || String(info.text || '').trim()) + const base = { + sourceNodeId: String(info.sourceNodeId || ''), + more: Number(info.more) || 0, + hasUpstream: hasUpstream, + } + if (own) return Object.assign({ text: '', own: true }, base) + return Object.assign({ text: String(info.text || ''), own: false }, base) } // 纯任务构建器:只根据节点图构造 prompt/参考图任务,不修改 state、不发送请求。 diff --git a/src/ui-node-bodies.js b/src/ui-node-bodies.js index 636163a..a26b382 100644 --- a/src/ui-node-bodies.js +++ b/src/ui-node-bodies.js @@ -370,6 +370,9 @@ function inheritBar(info, opts) { const o = opts || {} const own = !!info.own + // 没有上游节点(纯手写提示词)就不要显示「已固定 / 恢复跟随」, + // 否则点「恢复跟随」会把用户手写的文案清空。 + if (!info.hasUpstream) return null if (!own && !info.text) return null const srcName = nodeLabelOf(info.sourceNodeId, o.nodes) const parts = [