From b45d6b271209e89f440823ed245ad4b4fe0a75c4 Mon Sep 17 00:00:00 2001 From: qiqi Date: Tue, 24 Nov 2026 13:25:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(plugins):=20=E5=90=8C=E6=AD=A5=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E8=AF=8D=E5=BA=93=20promptlib=20v1.9.2=EF=BC=88?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E5=B0=81=E9=9D=A2=E5=BC=80=E5=85=B3=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/index.json | 4 ++-- plugins/promptlib/main.js | 20 ++++++++++++++++---- plugins/promptlib/manifest.json | 4 ++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/plugins/index.json b/plugins/index.json index cea38a7..cfe575e 100644 --- a/plugins/index.json +++ b/plugins/index.json @@ -44,9 +44,9 @@ "dir": "promptlib", "main": "main.js", "style": "styles.css", - "version": "1.9.1", + "version": "1.9.2", "files": { - "main.js": "9743c44630a5190f43921060dee1296052c96d9d958b2c95f53e70a1ab63603b", + "main.js": "e27a20c73d099903eaf090544a2f4a1fe3d8bc583155ae7f6d6c9e8c7417bef6", "styles.css": "d799321065172c2844c565cea9abc69053663ef9ec962e35911e0331bcff85aa" } }, diff --git a/plugins/promptlib/main.js b/plugins/promptlib/main.js index 11e8302..75e72a3 100644 --- a/plugins/promptlib/main.js +++ b/plugins/promptlib/main.js @@ -162,9 +162,16 @@ if (!item || typeof item.text !== 'string' || !item.text.trim()) return null return item } + // 分享是否附带封面图:后台设置页开关,默认带图(兼容老行为);关掉后分享文本只有文字,短很多。 + // 从 ctx.settings 读,manifest 里声明了 default:true —— 老客户端/未设置时也按“带图”走。 + function shareWithCover () { + var S = (PLP_CTX || {}).settings + return !S || typeof S.get !== 'function' || S.get('shareWithCover') !== false + } function plpSharePayload (p) { + var body = { app: 'image-workbench', kind: 'prompt-share', version: 1, sharing: { name: p.name || '', text: p.text || '', vars: detectVars(p.text || ''), group: p.group || '', tags: p.tags || [] } } + if (!shareWithCover()) return Promise.resolve(SHARE_TAG + '\n' + JSON.stringify(body)) return plpCoverUrl(p).then(function (cv) { - var body = { app: 'image-workbench', kind: 'prompt-share', version: 1, sharing: { name: p.name || '', text: p.text || '', vars: detectVars(p.text || ''), group: p.group || '', tags: p.tags || [] } } if (cv && cv.length < 300000) body.sharing.cover = cv return SHARE_TAG + '\n' + JSON.stringify(body) }) @@ -1304,8 +1311,10 @@ // 分享格式刻意做成「可读的 JSON 文本」,直接粘到微信/QQ 也能看懂;导入时两种都认: // ① 带 IWB-PROMPT 头的整段文本 ② 直接是 {kind:'prompt-share'} 的 JSON function sharePayload (p) { + var body = { app: 'image-workbench', kind: 'prompt-share', version: 1, sharing: { name: p.name || '', text: p.text || '', vars: varsOf(p), group: p.group || '', tags: p.tags || [] } } + // v1.9.2:后台「分享时附带封面图片」关掉后,连封面读取都跳过——分享文本只留文字,内容最少。 + if (!shareWithCover()) return Promise.resolve(SHARE_TAG + '\n' + JSON.stringify(body)) return coverToDataUrl(p).then(function (cv) { - var body = { app: 'image-workbench', kind: 'prompt-share', version: 1, sharing: { name: p.name || '', text: p.text || '', vars: varsOf(p), group: p.group || '', tags: p.tags || [] } } if (cv && cv.length < 300000) body.sharing.cover = cv return SHARE_TAG + '\n' + JSON.stringify(body) }) @@ -1870,11 +1879,14 @@ global.IWBPluginHost.register({ id: 'promptlib', name: '提示词库', - version: '1.9.1', + version: '1.9.2', apiVersion: 1, capabilities: ['panels', 'promptlib', 'nodeTypes', 'canvas', 'canvasWrite'], data: { schemaVersion: 3, maxBytes: 4 * 1024 * 1024 }, - settings: { panel: { type: 'custom', label: '分组与备份', render: renderPluginSettings } }, + settings: { + shareWithCover: { type: 'boolean', label: '分享时附带封面图片(关闭后分享内容更短)', default: true }, + panel: { type: 'custom', label: '分组与备份', render: renderPluginSettings }, + }, }, function (ctx) { PLP_CTX = ctx // v1.5.0:插件激活时就把旧数据迁到插件目录(不等面板打开), diff --git a/plugins/promptlib/manifest.json b/plugins/promptlib/manifest.json index 0ea8e71..585fc42 100644 --- a/plugins/promptlib/manifest.json +++ b/plugins/promptlib/manifest.json @@ -1,7 +1,7 @@ { "id": "promptlib", "name": "提示词库", - "version": "1.9.1", + "version": "1.9.2", "apiVersion": 1, "main": "main.js", "style": "styles.css", @@ -13,7 +13,7 @@ "提示词" ], "files": { - "main.js": "9743c44630a5190f43921060dee1296052c96d9d958b2c95f53e70a1ab63603b", + "main.js": "e27a20c73d099903eaf090544a2f4a1fe3d8bc583155ae7f6d6c9e8c7417bef6", "styles.css": "d799321065172c2844c565cea9abc69053663ef9ec962e35911e0331bcff85aa" } }