fix(canvas): 没有上游样式节点的提示词/文本节点不再显示「已固定 / 恢复跟随」(避免误点清空手写文案)
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m19s

This commit is contained in:
qiqi committed 2026-11-17 17:02:40 +08:00
1 parent 9623d932f7
commit f2c634ff38
2 files changed
+13 -3

No files matched your search

+10 -3
View File
@@ -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、不发送请求。
+3
View File
@@ -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 = [