koishi-plugin-p-draw 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -462,10 +462,17 @@ exports.apply = async function apply(ctx, cfg) {
462
462
  return { notices }
463
463
  }
464
464
 
465
- function buildChargeNotice({ isAdmin, totalPrice, unetName, seeds }) {
466
- if (isAdmin || !seeds.length) return ''
467
- return `已扣除 ${totalPrice} P 点,当前模型:${unetName},--seed=${seeds.join(',')}`
468
- }
465
+ function buildChargeNotice({ isAdmin, totalPrice, unetName, seeds }) {
466
+ if (isAdmin || !seeds.length) return ''
467
+ return `已扣除 ${totalPrice} P 点,当前模型:${unetName},--seed=${seeds.join(',')}`
468
+ }
469
+
470
+ function buildGenerationReply(session, { successCount, count, failures, notes = [] }) {
471
+ const reply = []
472
+ if (notes.length) reply.push(notes.join('\n'))
473
+ if (failures.length) reply.push(session.text('.batch-partial', [successCount, count, failures.length, failures.join(';')]))
474
+ return reply.filter(Boolean).join('\n')
475
+ }
469
476
 
470
477
  async function sendNotices(session, notices, opts = {}) {
471
478
  const content = notices.filter(Boolean).join('\n')
@@ -1467,15 +1474,7 @@ exports.apply = async function apply(ctx, cfg) {
1467
1474
  // 发图:合并转发,不引用原指令
1468
1475
  await sendImagesAsForward(session, forwardOutputs)
1469
1476
 
1470
- const reply = []
1471
- if (count > 1) {
1472
- reply.push(session.text('.generate-ok-batch', [count * price, successCount, seeds.join(', ') || '-']))
1473
- } else {
1474
- reply.push(session.text('.generate-ok', [price, seeds[0] || '-']))
1475
- }
1476
- if (notes.length) reply.push(notes.join('\n'))
1477
- if (failures.length) reply.push(session.text('.batch-partial', [successCount, count, failures.length, failures.join(';')]))
1478
- return reply.filter(Boolean).join('\n')
1477
+ return buildGenerationReply(session, { successCount, count, failures, notes })
1479
1478
  }
1480
1479
 
1481
1480
  // ---------------- 权限 ----------------
@@ -2005,14 +2004,7 @@ exports.apply = async function apply(ctx, cfg) {
2005
2004
  // 发图:合并转发,不引用原指令
2006
2005
  await sendImagesAsForward(session, forwardOutputs)
2007
2006
 
2008
- const reply = []
2009
- if (count > 1) {
2010
- reply.push(session.text('.generate-ok-batch', [count * cfg.price, successCount, seeds.join(', ') || '-']))
2011
- } else {
2012
- reply.push(session.text('.generate-ok', [cfg.price, seeds[0] || '-']))
2013
- }
2014
- if (failures.length) reply.push(session.text('.batch-partial', [successCount, count, failures.length, failures.join(';')]))
2015
- return reply.filter(Boolean).join('\n')
2007
+ return buildGenerationReply(session, { successCount, count, failures })
2016
2008
  }
2017
2009
  // ---------------- 提示词优化券交互式确认 ----------------
2018
2010
  // 仅全局优化关闭 + 非管理员 + 已配置 LLM(tokenOpt 分支)时进入。
@@ -2157,5 +2149,5 @@ exports.apply = async function apply(ctx, cfg) {
2157
2149
  })
2158
2150
 
2159
2151
  // 暴露内部接口供自动化测试调用(Koishi 忽略 apply 返回值,不影响生产行为)
2160
- return { couponConfirmFlow, buyCouponsAndConsume, normalizeConfirm, resolveCouponPrice, buildChargeNotice, sendNotices, sendImagesAsForward, executeBatch }
2161
- }
2152
+ return { couponConfirmFlow, buyCouponsAndConsume, normalizeConfirm, resolveCouponPrice, buildChargeNotice, buildGenerationReply, sendNotices, sendImagesAsForward, executeBatch }
2153
+ }
package/lib/i18n.js CHANGED
@@ -83,8 +83,6 @@ const zhCN = {
83
83
  'coupon-buy-pshort': 'P 点不足,无法购买提示词优化券(需 {0} P,现有 {1} P)。\n是否仍然生图(不使用 LLM 优化)?\n(回复「是」生图 / 回复「否」取消本次生图)',
84
84
  'coupon-consume-fail': '提示词优化券操作失败,本次未使用 LLM 优化。',
85
85
  'generate-failed': '生成失败:{0}',
86
- 'generate-ok': '已扣除 {0} P 点,seed={1}',
87
- 'generate-ok-batch': '已扣除 {0} P 点,共 {1} 张(seed:{2})',
88
86
  'batch-partial': '本次共生成 {0}/{1} 张,失败 {2} 张:{3}',
89
87
  'batch-limit': '每次最多生成 {0} 张,本次已按 {0} 张处理。',
90
88
  'batch-count': '本次共生成 {0} 张。',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-p-draw",
3
3
  "description": "p点-绘图,连接本地 ComfyUI 生图。支持自然语言优化、尺寸选择、画师组、固定角色、生成队列,需要配合 p-qiandao 使用",
4
- "version": "1.5.0",
4
+ "version": "1.5.1",
5
5
  "main": "index.js",
6
6
  "files": [
7
7
  "index.js",
package/readme.md CHANGED
@@ -20,7 +20,7 @@ p点-绘图插件,连接本地 ComfyUI 生图,参考 AstrBot 的 [anima 绘
20
20
  - 生成队列(逐张顺序执行,防止争抢 GPU)。
21
21
  - `p-draw 状态` 查看 ComfyUI 连接状态与模型可用性。
22
22
  - `p-draw help`(或 `帮助`)查看全部指令帮助,包含生成 / 多人 / 批量张数 / 尺寸 / 画师组 / 状态等。
23
- - 发图时会以合并转发发送,每张图片后附对应的 Positive / Negative 提示词;扣费提醒单独引用触发指令。
23
+ - 发图时会以合并转发发送,每张图片后附对应的 Positive / Negative 提示词;扣费提醒单独引用触发指令,并显示实际模型和 seed(如 `已扣除 750 P 点,当前模型:animagine-xl-3.1.safetensors,--seed=123456`)。
24
24
 
25
25
  ## 安装
26
26