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 = [