promptlib 1.14.16:导入分享保留 vars(修变量名称变内容/变量变少)
validate / validate (push) Waiting to run

This commit is contained in:
qiqi committed 2026-12-04 16:58:27 +08:00
1 parent db7f150a0c
commit 86ed4e7d6c
3 files changed
+11 -3

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@iwb-plugin/promptlib",
"private": true,
"version": "1.14.15",
"version": "1.14.16",
"description": "提示词库:右栏提示词列表(搜索/分组/收藏/新建编辑/插入画布/复制/删除),数据由宿主 promptlib 能力提供",
"ibwPlugin": {
"id": "promptlib",
+6 -2
View File
@@ -1597,7 +1597,11 @@
// 分享入库:剪贴板导入与文件导入共用,避免两套逻辑跑偏。
function importShareItem (item) {
var name = String(item.name || '').trim() || ('导入的提示词 ' + String(item.text).slice(0, 8) + '…')
var incoming = normalize({ id: uid('q'), name: name, text: item.text, group: String(item.group || ''), tags: item.tags || [] })
// 2026-12-05:分享里带了 vars(key/名称/内容/说明),导入时必须整段交给 normalize;
// 否则 varsOf 回落 detectVars(text) —— 正文 {} 里是内容原文 ⇒ 名称变成内容、同内容变量被去重合并。
var incoming = normalize({ id: uid('q'), name: name, text: item.text,
vars: Array.isArray(item.vars) ? item.vars : [],
group: String(item.group || ''), tags: item.tags || [] })
var cv = item.cover
var ready = (typeof cv === 'string' && cv.indexOf('data:') === 0 && FILEAPI)
? Promise.resolve(FILEAPI.put(coverFileName(cv), cv)).then(function (res) { return res && res.ok ? Object.assign({}, incoming, { cover: { img: coverFileName(cv) } }) : incoming }).catch(function () { return incoming })
@@ -2270,7 +2274,7 @@
global.IWBPluginHost.register({
id: 'promptlib',
name: '提示词库',
version: '1.14.15',
version: '1.14.16',
apiVersion: 1,
capabilities: ['panels', 'promptlib', 'nodeTypes', 'canvas', 'canvasWrite', 'nodeActions', 'commands'],
data: { schemaVersion: 3, maxBytes: 4 * 1024 * 1024 },
+4
View File
@@ -26,6 +26,10 @@ const pkgVer = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8
ok('manifest.version == package.json(' + pkgVer + ')', manVer === pkgVer, manVer)
ok('manifest 已移除「分享时附带封面图片」开关声明',
!/shareWithCover:\s*\{\s*type:\s*'boolean'/.test(src))
ok('导入分享保留 vars(v1.14.16:不再回落 detectVars——那会把内容当名称、同内容变量被合并)',
/function importShareItem \(item\)[\s\S]{0,600}vars: Array\.isArray\(item\.vars\)/.test(src))
ok('分享导出仍带 vars(与导入对得上,防单边改动)',
/sharing: \{[^}]*vars: varsOf\(p\)/.test(src))
ok('源码不再定义/读取 shareWithCover 设置',
!/function shareWithCover \(\)/.test(src) && !/S\.get\('shareWithCover'\)/.test(src))