chore(plugins): promptlib 1.8.5 市场同步
Verify (Gitea) / gate (build · unit · facts) (push) Canceled after 19s

This commit is contained in:
qiqi committed 2026-11-22 23:44:13 +08:00
1 parent bb0b3f3e8f
commit 5d68e0249a
3 files changed
+23 -8

No files matched your search

+2 -2
View File
@@ -44,9 +44,9 @@
"dir": "promptlib",
"main": "main.js",
"style": "styles.css",
"version": "1.8.4",
"version": "1.8.5",
"files": {
"main.js": "7fd3efe0b828786a9015e45f01c29704a4953ccdaec6a313c45d4f643f37618c",
"main.js": "710e93caae334973680e93e77e07c01437c8f63975f1479599aa3e13a79bca54",
"styles.css": "b8a689aa06690b6040a0b1c36afe085b5b6ddfedf9aea1728c3fa236a9a68acf"
}
},
+19 -4
View File
@@ -95,6 +95,15 @@
})
}
// 提交给下游/生图的文本:填完变量后,把未填的 {占位} 从输出里剔除(只在编辑器里展示)。
function outputText (tpl, vals) {
var s = fillTpl(tpl, vals)
return s.replace(/\{[^{}
]{1,24}\}/g, ' ').replace(/[ ]{2,}/g, ' ').replace(/\s*
\s*/g, '
').trim()
}
function varsOf (p) {
if (!p) return []
if (Array.isArray(p.vars) && p.vars.length) {
@@ -771,7 +780,7 @@
if (!w) return
var vd = varsOf(st.p)
if (vd.length) {
api2.createNode('ptpl', w.x, w.y, { promptId: '', name: st.p.name || '提示词模板', tpl: st.p.text || '', vdefs: vd, vars: {}, cover: st.p.cover || '', refOn: false, text: st.p.text || '', outKind: 'prompt' })
api2.createNode('ptpl', w.x, w.y, { promptId: '', name: st.p.name || '提示词模板', tpl: st.p.text || '', vdefs: vd, vars: {}, cover: st.p.cover || '', refOn: false, text: outputText(st.p.text || '', {}), outKind: 'prompt' })
notify('已插入模板节点:' + (st.p.name || ''))
} else {
api2.createNode('prompt', w.x, w.y, { text: st.p.text || '', title: st.p.name || '' })
@@ -848,7 +857,7 @@
notify('已插入封面图片')
} else if (kind === 'ptpl') {
var p = payload
var id2 = cw.createNode('ptpl', sw.x, sw.y, { promptId: p.id, name: p.name || '提示词模板', tpl: p.text || '', vdefs: varsOf(p), vars: {}, outKind: 'prompt', cover: p.cover || coverNameOf(p), refOn: false, text: p.text || '' })
var id2 = cw.createNode('ptpl', sw.x, sw.y, { promptId: p.id, name: p.name || '提示词模板', tpl: p.text || '', vdefs: varsOf(p), vars: {}, outKind: 'prompt', cover: p.cover || coverNameOf(p), refOn: false, text: outputText(p.text || '', {}) })
if (!id2) { notify('插入失败', 'err'); cancelPlacement(); return }
notify('已插入模板节点')
} else {
@@ -1749,7 +1758,7 @@
global.IWBPluginHost.register({
id: 'promptlib',
name: '提示词库',
version: '1.8.4',
version: '1.8.5',
apiVersion: 1,
capabilities: ['panels', 'promptlib', 'nodeTypes', 'canvas', 'canvasWrite'],
data: { schemaVersion: 3, maxBytes: 4 * 1024 * 1024 },
@@ -1889,6 +1898,12 @@
st.vars.appendChild(row)
})
if (!defs.length) st.vars.appendChild(el('div', { class: 'iwb-plp-nempty', text: '正文里没有 {变量}' }))
try {
var vv = {}
Object.keys(st.inputs).forEach(function (k) { vv[k] = st.inputs[k].value })
var clean = outputText(String(d.tpl || ''), vv)
if (d.text !== clean && props && typeof props.onUpdate === 'function') props.onUpdate(node.id, { text: clean })
} catch (e) { /* ignore */ }
}
// 缩略图:封面可能是 dataURL,也可能是插件文件引用
var cover = d.cover
@@ -1917,7 +1932,7 @@
st.timer = setTimeout(function () {
var vals = {}
Object.keys(st.inputs).forEach(function (k) { vals[k] = st.inputs[k].value })
var patch = { vars: vals, text: fillTpl(String(d.tpl || ''), vals) }
var patch = { vars: vals, text: outputText(String(d.tpl || ''), vals) }
try { st.props.onUpdate(st.node.id, patch) } catch (e) { /* ignore */ }
}, 300)
}
+2 -2
View File
@@ -1,7 +1,7 @@
{
"id": "promptlib",
"name": "提示词库",
"version": "1.8.4",
"version": "1.8.5",
"apiVersion": 1,
"main": "main.js",
"style": "styles.css",
@@ -13,7 +13,7 @@
"提示词"
],
"files": {
"main.js": "7fd3efe0b828786a9015e45f01c29704a4953ccdaec6a313c45d4f643f37618c",
"main.js": "710e93caae334973680e93e77e07c01437c8f63975f1479599aa3e13a79bca54",
"styles.css": "b8a689aa06690b6040a0b1c36afe085b5b6ddfedf9aea1728c3fa236a9a68acf"
}
}