diff --git a/promptlib/package.json b/promptlib/package.json index 490e7c1..8ddc893 100644 --- a/promptlib/package.json +++ b/promptlib/package.json @@ -1,7 +1,7 @@ { "name": "@iwb-plugin/promptlib", "private": true, - "version": "1.14.15", + "version": "1.14.16", "description": "提示词库:右栏提示词列表(搜索/分组/收藏/新建编辑/插入画布/复制/删除),数据由宿主 promptlib 能力提供", "ibwPlugin": { "id": "promptlib", diff --git a/promptlib/src/index.js b/promptlib/src/index.js index 89508e3..3bb844d 100644 --- a/promptlib/src/index.js +++ b/promptlib/src/index.js @@ -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 }, diff --git a/promptlib/tools/harness.mjs b/promptlib/tools/harness.mjs index 9d2a682..88ffdd5 100644 --- a/promptlib/tools/harness.mjs +++ b/promptlib/tools/harness.mjs @@ -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))