koishi-plugin-p-draw 1.2.6 → 1.2.7
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 +23 -7
- package/package.json +1 -1
- package/readme.md +1 -1
package/index.js
CHANGED
|
@@ -566,13 +566,19 @@ function animaI2IWorkflow(cfg, prompt, negativePrompt, width, height, steps, cfg
|
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
568
|
|
|
569
|
-
// 「换风格(漫画化)」i2i 工作流:LoadImage → Canny
|
|
569
|
+
// 「换风格(漫画化)」i2i 工作流:LoadImage → 预处理器(LineArt / Canny)→ AnimaLLLiteApply_sdscripts 锁构图,
|
|
570
570
|
// VAEEncode 原图作起点,KSampler 用较高 denoise 整体转二次元风格。
|
|
571
571
|
// 注意:Anima 是 MiniTrainDIT 架构(隐藏层 3584 维),与 Qwen-Image 系 ControlNet 不兼容
|
|
572
572
|
// (InstantX 控制网期望 3584 维文本嵌入,Anima 只给 1024 维 → LayerNorm 崩溃)。
|
|
573
573
|
// 因此这里使用 Anima 原生支持的 ControlNet-LLLite(kohya-ss/ComfyUI-Anima-LLLite),
|
|
574
574
|
// 节点直接对 MODEL 打补丁并返回补丁后的模型,交给 KSampler。
|
|
575
|
-
|
|
575
|
+
// 预处理器:comfyui_controlnet_aux 的 AnimeLineArt/LineArt 节点(需安装该自定义节点);
|
|
576
|
+
// 未安装时回退 ComfyUI 内置 Canny。anima-lllite-lineart 权重是按 lineart 训练的,用 LineArt 比 Canny 更贴。
|
|
577
|
+
function animaStyleI2IWorkflow(cfg, prompt, negativePrompt, width, height, steps, cfgVal, seed, inputImage, controlNetModel, controlNetStrength, denoise, preprocessor) {
|
|
578
|
+
const detectRes = Math.max(width, height)
|
|
579
|
+
const preprocessorNode = preprocessor === 'AnimeLineArtPreprocessor' || preprocessor === 'LineArtPreprocessor'
|
|
580
|
+
? { class_type: preprocessor, inputs: { image: ['13', 0], detect_resolution: detectRes, resolution: detectRes } }
|
|
581
|
+
: { class_type: 'Canny', inputs: { image: ['13', 0], low_threshold: 0.4, high_threshold: 0.8 } }
|
|
576
582
|
return {
|
|
577
583
|
'44': { class_type: 'UNETLoader', inputs: { unet_name: cfg.unetName, weight_dtype: 'fp8_e4m3fn' } },
|
|
578
584
|
'45': { class_type: 'CLIPLoader', inputs: { clip_name: cfg.clipName, type: 'stable_diffusion', device: 'default' } },
|
|
@@ -581,7 +587,7 @@ function animaStyleI2IWorkflow(cfg, prompt, negativePrompt, width, height, steps
|
|
|
581
587
|
'30': { class_type: 'VAEEncode', inputs: { pixels: ['13', 0], vae: ['15', 0] } },
|
|
582
588
|
'11': { class_type: 'CLIPTextEncode', inputs: { text: prompt, clip: ['45', 0] } },
|
|
583
589
|
'12': { class_type: 'CLIPTextEncode', inputs: { text: negativePrompt, clip: ['45', 0] } },
|
|
584
|
-
'70':
|
|
590
|
+
'70': preprocessorNode,
|
|
585
591
|
'71': { class_type: 'AnimaLLLiteApply_sdscripts', inputs: { model: ['44', 0], lllite_name: controlNetModel, image: ['70', 0], strength: controlNetStrength, start_percent: 0, end_percent: 1, preserve_wrapper: true } },
|
|
586
592
|
'19': {
|
|
587
593
|
class_type: 'KSampler',
|
|
@@ -649,7 +655,7 @@ function buildI2IWorkflow(cfg, prompt, negativePrompt, width, height, steps, cfg
|
|
|
649
655
|
return {
|
|
650
656
|
kind: 'controlnet',
|
|
651
657
|
denoise,
|
|
652
|
-
promptBody: animaStyleI2IWorkflow(cfg, prompt, negativePrompt, width, height, steps, cfgVal, seed, inputImage, caps.controlNet.model, Number(cfg.i2iControlNetStrength) || 0.7, denoise),
|
|
658
|
+
promptBody: animaStyleI2IWorkflow(cfg, prompt, negativePrompt, width, height, steps, cfgVal, seed, inputImage, caps.controlNet.model, Number(cfg.i2iControlNetStrength) || 0.7, denoise, caps.controlNet.preprocessor),
|
|
653
659
|
}
|
|
654
660
|
}
|
|
655
661
|
// 没有 ControlNet:换风格又不想崩构图,denoise 自动压到 0.5 以内
|
|
@@ -3187,11 +3193,12 @@ exports.apply = async function apply(ctx, cfg) {
|
|
|
3187
3193
|
return data.name
|
|
3188
3194
|
}
|
|
3189
3195
|
|
|
3190
|
-
// 检测 i2i 可用能力:Anima ControlNet-LLLite 节点与权重(comfyui-anima-lllite / kohya-ss/ComfyUI-Anima-LLLite
|
|
3191
|
-
//
|
|
3196
|
+
// 检测 i2i 可用能力:Anima ControlNet-LLLite 节点与权重(comfyui-anima-lllite / kohya-ss/ComfyUI-Anima-LLLite)、
|
|
3197
|
+
// LineArt 预处理器(comfyui_controlnet_aux,可选)与 Anima IP-Adapter 专用节点(comfyui-anima-ipadapter)。
|
|
3198
|
+
// 检测失败全部视为不可用(回退普通 img2img)。
|
|
3192
3199
|
// 注意:Qwen-Image InstantX ControlNet 与 Anima(MiniTrainDIT,3584 维)架构不兼容,这里只认 LLLite 权重。
|
|
3193
3200
|
async function detectI2ICapabilities() {
|
|
3194
|
-
const caps = { controlNet: { available: false, model: null }, ipAdapter: { available: false } }
|
|
3201
|
+
const caps = { controlNet: { available: false, model: null, preprocessor: 'Canny' }, ipAdapter: { available: false } }
|
|
3195
3202
|
let info
|
|
3196
3203
|
try {
|
|
3197
3204
|
info = await getObjectInfoCached()
|
|
@@ -3199,9 +3206,16 @@ exports.apply = async function apply(ctx, cfg) {
|
|
|
3199
3206
|
return caps
|
|
3200
3207
|
}
|
|
3201
3208
|
if (!info || typeof info !== 'object') return caps
|
|
3209
|
+
// LineArt 预处理器(comfyui_controlnet_aux):AnimeLineArt 更贴近漫画线条,优先;LineArt 次之;都没有则回退 Canny
|
|
3210
|
+
if (info.AnimeLineArtPreprocessor) {
|
|
3211
|
+
caps.controlNet.preprocessor = 'AnimeLineArtPreprocessor'
|
|
3212
|
+
} else if (info.LineArtPreprocessor) {
|
|
3213
|
+
caps.controlNet.preprocessor = 'LineArtPreprocessor'
|
|
3214
|
+
}
|
|
3202
3215
|
// Anima ControlNet-LLLite:lllite_name 从 models/controlnet 目录读取,只挑 anima-lllite 系权重
|
|
3203
3216
|
if (info.AnimaLLLiteApply_sdscripts) {
|
|
3204
3217
|
const llliteModels = availableModels(info, 'AnimaLLLiteApply_sdscripts', 'lllite_name')
|
|
3218
|
+
if (cfg.outputLogs) logger.info(`[p-draw] i2i LLLite 节点存在,models/controlnet 文件列表=${JSON.stringify(llliteModels)}`)
|
|
3205
3219
|
if (llliteModels.length) {
|
|
3206
3220
|
const configured = String(cfg.controlNetModel || '').trim()
|
|
3207
3221
|
const norm = (s) => String(s).toLowerCase().replace(/[-_ ]/g, '')
|
|
@@ -3213,6 +3227,8 @@ exports.apply = async function apply(ctx, cfg) {
|
|
|
3213
3227
|
caps.controlNet.model = configured && llliteModels.includes(configured) ? configured : best
|
|
3214
3228
|
caps.controlNet.available = !!caps.controlNet.model
|
|
3215
3229
|
}
|
|
3230
|
+
} else if (cfg.outputLogs) {
|
|
3231
|
+
logger.info('[p-draw] i2i 未检测到 AnimaLLLiteApply_sdscripts 节点(请确认已安装 kohya-ss/ComfyUI-Anima-LLLite 并重启 ComfyUI)')
|
|
3216
3232
|
}
|
|
3217
3233
|
if (info.AnimaIPAdapterLoader && info.AnimaIPAdapterApply && info.AnimaSiglipeEncodeImage) {
|
|
3218
3234
|
caps.ipAdapter.available = true
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -111,5 +111,5 @@ plugins:
|
|
|
111
111
|
- 券为一次性、**按张数消耗**:`x3` 需 3 张,每张图独立做一次 LLM 优化;券不足时该批不优化也不扣券(提示 `token-short`)。等待回复时间由 `couponAskTimeout`(秒)控制。
|
|
112
112
|
- **管理员在全局关闭时自动免费优化**(不耗券);`无优化` 原样模式不消耗、不询问。平台不支持交互确认时退回自动消耗逻辑。
|
|
113
113
|
- **未使用优化的提示**:单人生图没走 LLM 优化时会明确提示原因——未配置 LLM、未消耗优化券、或 `无优化` 原样模式;多人指令强依赖 LLM 规划,未配置 `llmBaseUrl`/`llmModel` 时会直接提示「多人指令需要 LLM 规划」。
|
|
114
|
-
- **i2i 增强模式依赖的节点**:换风格(漫画化)需要 ComfyUI 安装 [kohya-ss/ComfyUI-Anima-LLLite](https://github.com/kohya-ss/ComfyUI-Anima-LLLite) 自定义节点,并在 `models/controlnet/` 放一个 `anima-lllite` 系权重(`AnimaLLLiteApply_sdscripts` 节点下拉可见)。**注意:Anima 是 MiniTrainDIT 架构(3584 维),与 Qwen-Image 系 ControlNet(如 `Qwen-Image-InstantX-ControlNet-Union`)不兼容,装了也不会被本插件使用。**
|
|
114
|
+
- **i2i 增强模式依赖的节点**:换风格(漫画化)需要 ComfyUI 安装 [kohya-ss/ComfyUI-Anima-LLLite](https://github.com/kohya-ss/ComfyUI-Anima-LLLite) 自定义节点,并在 `models/controlnet/` 放一个 `anima-lllite` 系权重(`AnimaLLLiteApply_sdscripts` 节点下拉可见)。**注意:Anima 是 MiniTrainDIT 架构(3584 维),与 Qwen-Image 系 ControlNet(如 `Qwen-Image-InstantX-ControlNet-Union`)不兼容,装了也不会被本插件使用。** 可选安装 [comfyui_controlnet_aux](https://github.com/Fannovel16/comfyui_controlnet_aux) 获得 LineArt 预处理器(优先 `AnimeLineArtPreprocessor`,其次 `LineArtPreprocessor`),线条比内置 Canny 更贴合 lllite-lineart 权重;未安装时自动回退 Canny。换装换姿势需要安装 [comfyui-anima-ipadapter](https://github.com/Wenaka2004/comfyui-anima-ipadapter) 自定义节点并配置 `i2iIPAdapterPath`。以上节点缺失时都会自动回退普通 img2img 并提示,不影响出图。
|
|
115
115
|
- 本地模型不一定认识新角色,可用 `添加角色` 手动补充角色 tags。
|