koishi-plugin-p-draw 1.2.1 → 1.2.2

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 (2) hide show
  1. package/index.js +15 -6
  2. 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
- const extra = data.error.extra_info && data.error.extra_info.node_errors
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, 500)
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
 
@@ -3041,7 +3050,7 @@ exports.apply = async function apply(ctx, cfg) {
3041
3050
  logger.warn(`上传原图失败:${e.message}`)
3042
3051
  return session.text('.i2i-upload-fail', [e.message])
3043
3052
  }
3044
- if (cfg.outputLogs) logger.info(`[p-draw] i2i ${session.userId} 原图已上传:${uploadName}`)
3053
+ if (cfg.outputLogs) logger.info(`[p-draw] i2i ${session.userId} 原图已上传:${uploadName} 模式=${mode} ControlNet=${caps.controlNet.available ? caps.controlNet.model : '-'} IPAdapter=${caps.ipAdapter.available ? 'on' : 'off'}`)
3045
3054
 
3046
3055
  // 能力检测(ControlNet / Anima IP-Adapter)
3047
3056
  const caps = await detectI2ICapabilities()
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.2.1",
4
+ "version": "1.2.2",
5
5
  "main": "index.js",
6
6
  "files": [
7
7
  "index.js",