koishi-plugin-p-draw 1.2.1 → 1.2.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 +15 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1337,14 +1337,22 @@ exports.apply = async function apply(ctx, cfg) {
|
|
|
1337
1337
|
const detail = (() => {
|
|
1338
1338
|
try {
|
|
1339
1339
|
const data = JSON.parse(text)
|
|
1340
|
+
const nodeErrors = (data && data.node_errors) || (data && data.error && data.error.extra_info && data.error.extra_info.node_errors) || null
|
|
1341
|
+
if (nodeErrors && typeof nodeErrors === 'object') {
|
|
1342
|
+
const lines = Object.entries(nodeErrors).map(([id, e]) => {
|
|
1343
|
+
const cls = (e && e.class_type) || ''
|
|
1344
|
+
const errs = (e && Array.isArray(e.errors) && e.errors.length)
|
|
1345
|
+
? e.errors.map(x => `${(x && x.message) || ''}${x && x.details ? ' | ' + x.details : ''}`.trim()).join('; ')
|
|
1346
|
+
: JSON.stringify(e)
|
|
1347
|
+
return ` #${id} [${cls}]: ${errs}`
|
|
1348
|
+
})
|
|
1349
|
+
if (lines.length) return `\n${lines.join('\n')}`
|
|
1350
|
+
}
|
|
1340
1351
|
if (data && data.error) {
|
|
1341
|
-
|
|
1342
|
-
? Object.entries(data.error.extra_info.node_errors).map(([id, e]) => `${id}:${e.class_type || ''} → ${e.errors ? e.errors.map(x => (x && x.message) || JSON.stringify(x)).join('; ') : JSON.stringify(e)}`).join('\n')
|
|
1343
|
-
: ''
|
|
1344
|
-
return `${data.error.message || ''}${data.error.details ? ' ' + data.error.details : ''}${extra ? '\n' + extra : ''}`.trim()
|
|
1352
|
+
return `${data.error.message || ''}${data.error.details ? ' ' + data.error.details : ''}`.trim()
|
|
1345
1353
|
}
|
|
1346
1354
|
} catch (e) { /* ignore */ }
|
|
1347
|
-
return text.slice(0,
|
|
1355
|
+
return text.slice(0, 800)
|
|
1348
1356
|
})()
|
|
1349
1357
|
throw new Error(`HTTP ${res.status}${detail ? ':' + detail : ''}`)
|
|
1350
1358
|
}
|
|
@@ -1622,6 +1630,7 @@ exports.apply = async function apply(ctx, cfg) {
|
|
|
1622
1630
|
const submit = await comfyPost('/prompt', { prompt: promptBody, client_id: clientId }, 20000)
|
|
1623
1631
|
const promptId = submit && submit.prompt_id
|
|
1624
1632
|
if (!promptId) {
|
|
1633
|
+
if (cfg.outputLogs) logger.warn(`[p-draw] ComfyUI 提交失败,工作流:\n${JSON.stringify(promptBody).slice(0, 3000)}`)
|
|
1625
1634
|
return { ok: false, message: `ComfyUI 提交失败:${JSON.stringify(submit || {}).slice(0, 300)}` }
|
|
1626
1635
|
}
|
|
1627
1636
|
|
|
@@ -3062,6 +3071,7 @@ exports.apply = async function apply(ctx, cfg) {
|
|
|
3062
3071
|
if (mode === 'style') await session.send(session.text('.i2i-mode-style'))
|
|
3063
3072
|
if (mode === 'ootd') await session.send(session.text('.i2i-mode-ootd'))
|
|
3064
3073
|
}
|
|
3074
|
+
if (cfg.outputLogs) logger.info(`[p-draw] i2i ${session.userId} 模式=${mode} ControlNet=${caps.controlNet.available ? caps.controlNet.model : '-'} IPAdapter=${caps.ipAdapter.available ? 'on' : 'off'}`)
|
|
3065
3075
|
|
|
3066
3076
|
// 所选模式依赖的节点缺失时给出提示(仍会回退普通 img2img,不中断)
|
|
3067
3077
|
const notices = []
|