koishi-plugin-p-draw 1.5.2 → 1.5.4

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.
Files changed (3) hide show
  1. package/index.js +11 -12
  2. package/package.json +1 -1
  3. package/readme.md +1 -1
package/index.js CHANGED
@@ -462,13 +462,16 @@ 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(',')}`
465
+ function buildChargeNotice({ isAdmin, totalPrice, unetName, seeds }) {
466
+ if (!seeds.length) return ''
467
+ const modelSeed = `当前模型:${unetName},--seed=${seeds.join(',')}`
468
+ if (isAdmin) return modelSeed
469
+ return `已扣除 ${totalPrice} P 点,${modelSeed}`
468
470
  }
469
471
 
470
- function buildGenerationReply(session, { successCount, count, failures, notes = [] }) {
472
+ function buildGenerationReply(session, { successCount, count, failures, notes = [], chargeNotice = '' }) {
471
473
  const reply = []
474
+ if (chargeNotice) reply.push(chargeNotice)
472
475
  if (notes.length) reply.push(notes.join('\n'))
473
476
  if (failures.length) reply.push(session.text('.batch-partial', [successCount, count, failures.length, failures.join(';')]))
474
477
  return reply.filter(Boolean).join('\n')
@@ -1470,9 +1473,7 @@ exports.apply = async function apply(ctx, cfg) {
1470
1473
  unetName: unet,
1471
1474
  seeds,
1472
1475
  })
1473
- await sendNotices(session, [chargeNotice], { quote: true })
1474
-
1475
- if (!allOutputs.length) {
1476
+ if (!allOutputs.length) {
1476
1477
  if (cfg.outputLogs) logger.warn(`多人生成全部失败(${USERID}),已按张退款`)
1477
1478
  return session.text('.generate-failed', ['全部失败(已按张退款)'])
1478
1479
  }
@@ -1482,7 +1483,7 @@ exports.apply = async function apply(ctx, cfg) {
1482
1483
  // 发图:合并转发,不引用原指令
1483
1484
  await sendImagesAsForward(session, forwardOutputs)
1484
1485
 
1485
- return buildGenerationReply(session, { successCount, count, failures, notes })
1486
+ return buildGenerationReply(session, { successCount, count, failures, notes, chargeNotice })
1486
1487
  }
1487
1488
 
1488
1489
  // ---------------- 权限 ----------------
@@ -2000,9 +2001,7 @@ exports.apply = async function apply(ctx, cfg) {
2000
2001
  unetName: unet,
2001
2002
  seeds,
2002
2003
  })
2003
- await sendNotices(session, [chargeNotice], { quote: true })
2004
-
2005
- if (!allOutputs.length) {
2004
+ if (!allOutputs.length) {
2006
2005
  if (cfg.outputLogs) logger.warn(`生成全部失败(${USERID}),已按张退款`)
2007
2006
  return session.text('.generate-failed', ['全部失败(已按张退款)'])
2008
2007
  }
@@ -2012,7 +2011,7 @@ exports.apply = async function apply(ctx, cfg) {
2012
2011
  // 发图:合并转发,不引用原指令
2013
2012
  await sendImagesAsForward(session, forwardOutputs)
2014
2013
 
2015
- return buildGenerationReply(session, { successCount, count, failures })
2014
+ return buildGenerationReply(session, { successCount, count, failures, chargeNotice })
2016
2015
  }
2017
2016
  // ---------------- 提示词优化券交互式确认 ----------------
2018
2017
  // 仅全局优化关闭 + 非管理员 + 已配置 LLM(tokenOpt 分支)时进入。
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.2",
4
+ "version": "1.5.4",
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 提示词;扣费提醒单独引用触发指令,并显示实际模型和 seed(如 `已扣除 750 P 点,当前模型:animagine-xl-3.1.safetensors,--seed=123456`)。OneBot/NapCat 自动使用原生 `reply` 消息段发送引用。
23
+ - 发图时会以合并转发发送,每张图片后附对应的 Positive / Negative 提示词;生成完成消息会显示实际模型和 seed(如 `已扣除 750 P 点,当前模型:animagine-xl-3.1.safetensors,--seed=123456`)。管理员/免扣费用户不显示扣费金额,但仍显示模型和 seed。
24
24
 
25
25
  ## 安装
26
26