koishi-plugin-p-draw 1.5.1 → 1.5.3
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 +22 -17
- package/package.json +1 -1
- package/readme.md +1 -1
package/index.js
CHANGED
|
@@ -467,21 +467,30 @@ exports.apply = async function apply(ctx, cfg) {
|
|
|
467
467
|
return `已扣除 ${totalPrice} P 点,当前模型:${unetName},--seed=${seeds.join(',')}`
|
|
468
468
|
}
|
|
469
469
|
|
|
470
|
-
function buildGenerationReply(session, { successCount, count, failures, notes = [] }) {
|
|
470
|
+
function buildGenerationReply(session, { successCount, count, failures, notes = [], chargeNotice = '' }) {
|
|
471
471
|
const reply = []
|
|
472
|
+
if (chargeNotice) reply.push(chargeNotice)
|
|
472
473
|
if (notes.length) reply.push(notes.join('\n'))
|
|
473
474
|
if (failures.length) reply.push(session.text('.batch-partial', [successCount, count, failures.length, failures.join(';')]))
|
|
474
475
|
return reply.filter(Boolean).join('\n')
|
|
475
476
|
}
|
|
476
477
|
|
|
477
|
-
async function sendNotices(session, notices, opts = {}) {
|
|
478
|
-
const content = notices.filter(Boolean).join('\n')
|
|
479
|
-
if (!content) return
|
|
480
|
-
try {
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
478
|
+
async function sendNotices(session, notices, opts = {}) {
|
|
479
|
+
const content = notices.filter(Boolean).join('\n')
|
|
480
|
+
if (!content) return
|
|
481
|
+
try {
|
|
482
|
+
const quoteId = session.event?.message?.id || session.messageId
|
|
483
|
+
let message = content
|
|
484
|
+
if (opts.quote && quoteId) {
|
|
485
|
+
const quote = session.platform === 'onebot'
|
|
486
|
+
? h('reply', { id: quoteId })
|
|
487
|
+
: h.quote(quoteId)
|
|
488
|
+
message = quote + content
|
|
489
|
+
}
|
|
490
|
+
if (cfg.outputLogs && opts.quote) logger.info(`[p-draw] 发送扣费引用通知 platform=${session.platform || 'unknown'} messageId=${quoteId || 'missing'}`)
|
|
491
|
+
await session.send(message)
|
|
492
|
+
} catch (e) {
|
|
493
|
+
logger.warn(`发送反馈消息失败:${e.message}`)
|
|
485
494
|
}
|
|
486
495
|
}
|
|
487
496
|
|
|
@@ -1462,9 +1471,7 @@ exports.apply = async function apply(ctx, cfg) {
|
|
|
1462
1471
|
unetName: unet,
|
|
1463
1472
|
seeds,
|
|
1464
1473
|
})
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
if (!allOutputs.length) {
|
|
1474
|
+
if (!allOutputs.length) {
|
|
1468
1475
|
if (cfg.outputLogs) logger.warn(`多人生成全部失败(${USERID}),已按张退款`)
|
|
1469
1476
|
return session.text('.generate-failed', ['全部失败(已按张退款)'])
|
|
1470
1477
|
}
|
|
@@ -1474,7 +1481,7 @@ exports.apply = async function apply(ctx, cfg) {
|
|
|
1474
1481
|
// 发图:合并转发,不引用原指令
|
|
1475
1482
|
await sendImagesAsForward(session, forwardOutputs)
|
|
1476
1483
|
|
|
1477
|
-
return buildGenerationReply(session, { successCount, count, failures, notes })
|
|
1484
|
+
return buildGenerationReply(session, { successCount, count, failures, notes, chargeNotice })
|
|
1478
1485
|
}
|
|
1479
1486
|
|
|
1480
1487
|
// ---------------- 权限 ----------------
|
|
@@ -1992,9 +1999,7 @@ exports.apply = async function apply(ctx, cfg) {
|
|
|
1992
1999
|
unetName: unet,
|
|
1993
2000
|
seeds,
|
|
1994
2001
|
})
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
if (!allOutputs.length) {
|
|
2002
|
+
if (!allOutputs.length) {
|
|
1998
2003
|
if (cfg.outputLogs) logger.warn(`生成全部失败(${USERID}),已按张退款`)
|
|
1999
2004
|
return session.text('.generate-failed', ['全部失败(已按张退款)'])
|
|
2000
2005
|
}
|
|
@@ -2004,7 +2009,7 @@ exports.apply = async function apply(ctx, cfg) {
|
|
|
2004
2009
|
// 发图:合并转发,不引用原指令
|
|
2005
2010
|
await sendImagesAsForward(session, forwardOutputs)
|
|
2006
2011
|
|
|
2007
|
-
return buildGenerationReply(session, { successCount, count, failures })
|
|
2012
|
+
return buildGenerationReply(session, { successCount, count, failures, chargeNotice })
|
|
2008
2013
|
}
|
|
2009
2014
|
// ---------------- 提示词优化券交互式确认 ----------------
|
|
2010
2015
|
// 仅全局优化关闭 + 非管理员 + 已配置 LLM(tokenOpt 分支)时进入。
|
package/package.json
CHANGED
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
|
|