diff --git a/CHANGELOG.md b/CHANGELOG.md index db7ad17..bef11a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ - Fixed ab Images losing all of its interactions on the current frontend (image display, A/B switching, context menu, minimum size) - 修复通过 ComfyUI Manager 安装时 GuLuLu 图片加载不出来的问题 - Fixed the GuLuLu image failing to load when installed via ComfyUI Manager +- 修复 𝙆 Run 劫持队列接口时吞掉参数,导致 ComfyUI 原生的局部执行退化为运行整个工作流、UI 里设置的预览方式失效 +- Fixed the Run override swallowing queue parameters, which turned ComfyUI's own partial execution into a full-workflow run and disabled the preview method set in the UI +- 修复在设置中关闭 Monitor 按钮后,刷新页面按钮又会出现的问题 +- Fixed the Monitor button reappearing after a refresh once it had been turned off in settings +- 修复缺少 pilgram 时会尝试调用 pip 安装、在没有 pip 的虚拟环境中导致整个插件加载失败的问题 +- Fixed a missing pilgram triggering a pip install that breaks loading the whole plugin in environments without pip +- 补齐 pyproject.toml 中缺失的依赖声明(pilgram、requests) +- Declared the dependencies missing from pyproject.toml (pilgram, requests) - 修复节点排版工具栏在新版前端下完全消失、快捷键同时失效的问题 - Fixed the node align toolbar disappearing entirely on the current frontend, which also disabled its shortcuts - 工具栏改为完全自由的浮窗,自带拖拽手柄,拖到哪就停在哪,不再依附于官方「运行」按钮 diff --git a/README.md b/README.md index 16f472a..216ed3e 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,14 @@ This is a custom node utility package developed for ComfyUI. Initially created f - Fixed ab Images losing all of its interactions on the current frontend (image display, A/B switching, context menu, minimum size) - 修复通过 ComfyUI Manager 安装时 GuLuLu 图片加载不出来的问题 - Fixed the GuLuLu image failing to load when installed via ComfyUI Manager +- 修复 𝙆 Run 劫持队列接口时吞掉参数,导致 ComfyUI 原生的局部执行退化为运行整个工作流、UI 里设置的预览方式失效 +- Fixed the Run override swallowing queue parameters, which turned ComfyUI's own partial execution into a full-workflow run and disabled the preview method set in the UI +- 修复在设置中关闭 Monitor 按钮后,刷新页面按钮又会出现的问题 +- Fixed the Monitor button reappearing after a refresh once it had been turned off in settings +- 修复缺少 pilgram 时会尝试调用 pip 安装、在没有 pip 的虚拟环境中导致整个插件加载失败的问题 +- Fixed a missing pilgram triggering a pip install that breaks loading the whole plugin in environments without pip +- 补齐 pyproject.toml 中缺失的依赖声明(pilgram、requests) +- Declared the dependencies missing from pyproject.toml (pilgram, requests) - 修复节点排版工具栏在新版前端下完全消失、快捷键同时失效的问题 - Fixed the node align toolbar disappearing entirely on the current frontend, which also disabled its shortcuts - 工具栏改为完全自由的浮窗,自带拖拽手柄,拖到哪就停在哪,不再依附于官方「运行」按钮 diff --git a/nodes/color_adjustment.py b/nodes/color_adjustment.py index 07e7c8b..292a54d 100644 --- a/nodes/color_adjustment.py +++ b/nodes/color_adjustment.py @@ -1,13 +1,20 @@ import os +import logging import numpy as np from PIL import Image, ImageEnhance import torch -import subprocess +# 缺了 pilgram 就只是没有滤镜可选,不该把整个包的导入拖垮。 +# 原来这里会 subprocess 调 `pip install`,但 uv 建的虚拟环境里根本没有 pip 模块, +# 直接抛异常 —— 整个 KayTool 都会加载失败,节点全部消失。 try: import pilgram except ImportError: - subprocess.check_call(['pip', 'install', 'pilgram']) + pilgram = None + logging.warning( + "[KayTool] pilgram not installed, Color Adjustment filters are unavailable. " + "Install it with: pip install pilgram" + ) def tensor2pil(image): @@ -19,6 +26,8 @@ def pil2tensor(image): def get_pilgram_filters(): + if pilgram is None: + return ["None"] filters = [f for f in dir(pilgram) if not f.startswith('_') and callable(getattr(pilgram, f))] numbered_filters = [f"{i+1}_{filters[i]}" for i in range(len(filters))] numbered_filters.insert(0, "None") @@ -109,7 +118,7 @@ class ColorAdjustment: pil_img = tensor2pil(img) pil_img = self.adjust_exposure_contrast_color(pil_img, exposure, contrast, temperature, tint, saturation) - if style != "None": + if style != "None" and pilgram is not None: filter_name_clean = style.split('_', 1)[1] filter_func = getattr(pilgram, filter_name_clean) filtered_img = filter_func(pil_img) diff --git a/pyproject.toml b/pyproject.toml index f8361c2..1b86e6b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "kaytool" description ="KayTool boosts ComfyUI workflow efficiency with powerful tools like: image processing (resize, color, blur, expand, merge, crop), background/mask tasks via BiRefNet/RemBG, wireless data transfer (Set&Get), AI translation (Tencent/Baidu), Professional high-precision resource monitoring, dynamic math operations, flexible text handling, precision sliders, metadata/color profile-supported image saving, batch processing via folder loading, canvas node map export as PNG with metadata, quick Run options via right-click, node alignment toolbar with custom styles, and custom ComfyUI logo integration." version = "0.70.17" license = {file = "LICENSE"} -dependencies = ["rembg", "timm", "opencv-python", "py-cpuinfo", "pynvml"] +dependencies = ["rembg", "timm", "opencv-python", "py-cpuinfo", "pynvml", "pilgram", "requests"] [project.urls] Repository = "https://github.com/kk8bit/kaytool" diff --git a/web/quickaddsetget.js b/web/quickaddsetget.js index b7c87d1..ef7eb36 100644 --- a/web/quickaddsetget.js +++ b/web/quickaddsetget.js @@ -75,7 +75,7 @@ app.registerExtension({ setup() { const originalApiQueuePrompt = api.queuePrompt; api.queuePrompt = async function (index, prompt) { - if (KayToolState.queueNodeIds?.length && prompt.output) { + if (KayToolState.queueNodeIds?.length && prompt?.output) { const oldOutput = prompt.output; let newOutput = {}; for (const queueNodeId of KayToolState.queueNodeIds) { @@ -83,7 +83,10 @@ app.registerExtension({ } prompt.output = newOutput; } - return originalApiQueuePrompt.apply(this, [index, prompt]); + // 必须原样透传所有参数。queuePrompt 的第三个参数带着 ComfyUI 的 + // partialExecutionTargets(局部执行)和 previewMethod(预览方式), + // 只转发前两个会把它们丢掉,局部执行会变成跑全图、UI 里设的预览也会失效。 + return originalApiQueuePrompt.apply(this, arguments); }; const originalDraw = LGraphCanvas.prototype.draw; diff --git a/web/resourcemonitor.js b/web/resourcemonitor.js index 78943f0..d5e7729 100644 --- a/web/resourcemonitor.js +++ b/web/resourcemonitor.js @@ -871,6 +871,9 @@ app.registerExtension({ tooltip: KayResourceMonitor.isVisible ? "Hide Monitor" : "Show Monitor" }); KayResourceMonitor.menuButton = showMenuButton.element; + // 设置项的 onChange 只在开关被拨动时触发,页面刷新走的是这里, + // 所以初始显隐必须自己按设置来一次,否则关掉的按钮一刷新就又冒出来。 + showMenuButton.element.style.display = KayResourceMonitor.isEnabled ? '' : 'none'; if (app.menu?.settingsGroup) { app.menu.settingsGroup.append(showMenuButton); }