diff --git a/__init__.py b/__init__.py index 3bac1292..7eeece06 100644 --- a/__init__.py +++ b/__init__.py @@ -20,7 +20,7 @@ import nodes import torch -version = "V1.11.5" +version = "V1.12.1" print(f"### Loading: ComfyUI-Manager ({version})") @@ -1517,6 +1517,28 @@ async def install_model(request): return web.Response(status=400) +class ManagerTerminalHook: + def write_stderr(self, msg): + server.PromptServer.instance.send_sync("manager-terminal-feedback", {"data": msg}) + + def write_stdout(self, msg): + server.PromptServer.instance.send_sync("manager-terminal-feedback", {"data": msg}) + + +manager_terminal_hook = ManagerTerminalHook() + + +@server.PromptServer.instance.routes.get("/manager/terminal") +async def terminal_mode(request): + if "mode" in request.rel_url.query: + if request.rel_url.query['mode'] == 'true': + sys.__comfyui_manager_terminal_hook.add_hook('cm', manager_terminal_hook) + else: + sys.__comfyui_manager_terminal_hook.remove_hook('cm') + + return web.Response(status=200) + + @server.PromptServer.instance.routes.get("/manager/preview_method") async def preview_method(request): if "value" in request.rel_url.query: diff --git a/custom-node-list.json b/custom-node-list.json index 086c8d98..20b6d1e9 100644 --- a/custom-node-list.json +++ b/custom-node-list.json @@ -2374,7 +2374,7 @@ "https://github.com/drustan-hawk/primitive-types" ], "install_type": "git-clone", - "description": "A text-to-speech plugin used under ComfyUI. It utilizes the Microsoft Speech TTS interface to convert text content into MP3 format audio files." + "description": "This repository contains typed primitives for ComfyUI. The motivation for these primitives is that the standard primitive node cannot be routed." }, { "author": "shadowcz007", @@ -3068,6 +3068,16 @@ "install_type": "git-clone", "description": "This is an Extension for ComfyUI, which helps formatting texts." }, + { + "author": "Haoming02", + "title": "ComfyUI Clear Screen", + "reference": "https://github.com/Haoming02/comfyui-clear-screen", + "files": [ + "https://github.com/Haoming02/comfyui-clear-screen" + ], + "install_type": "git-clone", + "description": "This is an Extension for ComfyUI, which adds a button, CLS, to clear the console window." + }, { "author": "bedovyy", "title": "ComfyUI_NAIDGenerator", @@ -3310,6 +3320,16 @@ "install_type": "git-clone", "description": "[PoC] This extension implements [a/DemoFusion](https://ruoyidu.github.io/demofusion/demofusion.html)." }, + { + "author": "spacepxl", + "title": "ComfyUI-Image-Filters", + "reference": "https://github.com/spacepxl/ComfyUI-Image-Filters", + "files": [ + "https://github.com/spacepxl/ComfyUI-Image-Filters" + ], + "install_type": "git-clone", + "description": "Image and matte filtering nodes for ComfyUI `image/filters/*`" + }, { "author": "Ser-Hilary", "title": "SDXL_sizing", diff --git a/extension-node-map.json b/extension-node-map.json index ae40c96e..4df51383 100644 --- a/extension-node-map.json +++ b/extension-node-map.json @@ -3798,7 +3798,6 @@ ], "https://github.com/knuknX/ComfyUI-Image-Tools": [ [ - "ImageBatchSqueezeProcessor", "ImageBgRemoveProcessor", "ImageStandardResizeProcessor", "SingleImagePathLoader", @@ -4061,6 +4060,7 @@ "Segs Mask ForEach", "SegsMaskCombine", "SegsToCombinedMask", + "SetDefaultImageForSEGS", "SubtractMask", "SubtractMaskForEach", "TiledKSamplerProvider", @@ -4730,6 +4730,8 @@ "ShowLayer", "ShowTextForGPT", "SmoothMask", + "SpeechRecognition", + "SpeechSynthesis", "SplitLongMask", "SvgImage", "TextImage", @@ -4893,6 +4895,17 @@ "title_aux": "ComfyUI-HQ-Image-Save" } ], + "https://github.com/spacepxl/ComfyUI-Image-Filters": [ + [ + "AlphaClean", + "EnhanceDetail", + "GuidedFilterAlpha", + "RemapRange" + ], + { + "title_aux": "ComfyUI-Image-Filters" + } + ], "https://github.com/spinagon/ComfyUI-seam-carving": [ [ "SeamCarving" diff --git a/js/terminal.js b/js/terminal.js new file mode 100644 index 00000000..091959fa --- /dev/null +++ b/js/terminal.js @@ -0,0 +1,81 @@ +import {app} from "../../scripts/app.js"; +import {ComfyWidgets} from "../../scripts/widgets.js"; +// Node that add notes to your project + +let terminal_node; +let log_mode = false; + +app.registerExtension({ + name: "Comfy.Manager.Terminal", + + registerCustomNodes() { + class TerminalNode { + color = "#222222"; + bgcolor = "#000000"; + groupcolor = LGraphCanvas.node_colors.black.groupcolor; + constructor() { + this.logs = []; + + if (!this.properties) { + this.properties = {}; + this.properties.text=""; + } + + ComfyWidgets.STRING(this, "", ["", {default:this.properties.text, multiline: true}], app) + ComfyWidgets.BOOLEAN(this, "mode", ["", {default:true, label_on:'Logging', label_off:'Stop'}], app) + ComfyWidgets.INT(this, "lines", ["", {default:500, min:10, max:10000, steps:1}], app) + + let self = this; + Object.defineProperty(this.widgets[1], 'value', { + set: (v) => { + api.fetchApi(`/manager/terminal?mode=${v}`, {}); + log_mode = v; + }, + get: () => { + return log_mode; + } + }); + + this.serialize_widgets = false; + this.isVirtualNode = true; + + if(terminal_node) { + try { + terminal_node.widgets[0].value = 'The output of this node is disabled because another terminal node has appeared.'; + } + catch {} + } + terminal_node = this; + } + } + + // Load default visibility + LiteGraph.registerNodeType( + "Terminal Log //CM", + Object.assign(TerminalNode, { + title_mode: LiteGraph.NORMAL_TITLE, + title: "Terminal Log (Manager)", + collapsable: true, + }) + ); + + TerminalNode.category = "utils"; + }, +}); + + +import { api } from "../../scripts/api.js"; + +function terminalFeedback(event) { + if(terminal_node) { + terminal_node.logs.push(event.detail.data); + if(terminal_node.logs.length > terminal_node.widgets[2].value) { + terminal_node.logs.shift(); + if(terminal_node.logs[0] == '' || terminal_node.logs[0] == '\n') + terminal_node.logs.shift(); + } + terminal_node.widgets[0].value = [...terminal_node.logs].reverse().join('').trim(); + } +} + +api.addEventListener("manager-terminal-feedback", terminalFeedback); diff --git a/node_db/new/custom-node-list.json b/node_db/new/custom-node-list.json index dabbfdc6..6cc61478 100644 --- a/node_db/new/custom-node-list.json +++ b/node_db/new/custom-node-list.json @@ -1,5 +1,25 @@ { "custom_nodes": [ + { + "author": "spacepxl", + "title": "ComfyUI-Image-Filters", + "reference": "https://github.com/spacepxl/ComfyUI-Image-Filters", + "files": [ + "https://github.com/spacepxl/ComfyUI-Image-Filters" + ], + "install_type": "git-clone", + "description": "Image and matte filtering nodes for ComfyUI `image/filters/*`" + }, + { + "author": "Haoming02", + "title": "ComfyUI Clear Screen", + "reference": "https://github.com/Haoming02/comfyui-clear-screen", + "files": [ + "https://github.com/Haoming02/comfyui-clear-screen" + ], + "install_type": "git-clone", + "description": "This is an Extension for ComfyUI, which adds a button, CLS, to clear the console window." + }, { "author": "deroberon", "title": "demofusion-comfyui", diff --git a/node_db/new/extension-node-map.json b/node_db/new/extension-node-map.json index ae40c96e..4df51383 100644 --- a/node_db/new/extension-node-map.json +++ b/node_db/new/extension-node-map.json @@ -3798,7 +3798,6 @@ ], "https://github.com/knuknX/ComfyUI-Image-Tools": [ [ - "ImageBatchSqueezeProcessor", "ImageBgRemoveProcessor", "ImageStandardResizeProcessor", "SingleImagePathLoader", @@ -4061,6 +4060,7 @@ "Segs Mask ForEach", "SegsMaskCombine", "SegsToCombinedMask", + "SetDefaultImageForSEGS", "SubtractMask", "SubtractMaskForEach", "TiledKSamplerProvider", @@ -4730,6 +4730,8 @@ "ShowLayer", "ShowTextForGPT", "SmoothMask", + "SpeechRecognition", + "SpeechSynthesis", "SplitLongMask", "SvgImage", "TextImage", @@ -4893,6 +4895,17 @@ "title_aux": "ComfyUI-HQ-Image-Save" } ], + "https://github.com/spacepxl/ComfyUI-Image-Filters": [ + [ + "AlphaClean", + "EnhanceDetail", + "GuidedFilterAlpha", + "RemapRange" + ], + { + "title_aux": "ComfyUI-Image-Filters" + } + ], "https://github.com/spinagon/ComfyUI-seam-carving": [ [ "SeamCarving" diff --git a/prestartup_script.py b/prestartup_script.py index 4dc4d104..a227ff6d 100644 --- a/prestartup_script.py +++ b/prestartup_script.py @@ -33,6 +33,36 @@ restore_snapshot_path = os.path.join(startup_script_path, "restore-snapshot.json git_script_path = os.path.join(comfyui_manager_path, "git_helper.py") +class TerminalHook: + def __init__(self): + self.hooks = {} + + def add_hook(self, k, v): + self.hooks[k] = v + + def remove_hook(self, k): + if k in self.hooks: + del self.hooks[k] + + def write_stderr(self, msg): + for v in self.hooks.values(): + try: + v.write_stderr(msg) + except Exception: + pass + + def write_stdout(self, msg): + for v in self.hooks.values(): + try: + v.write_stdout(msg) + except Exception: + pass + + +terminal_hook = TerminalHook() +sys.__comfyui_manager_terminal_hook = terminal_hook + + def handle_stream(stream, prefix): stream.reconfigure(encoding=locale.getpreferredencoding(), errors='replace') for msg in stream: @@ -157,9 +187,11 @@ try: if self.is_stdout: original_stdout.write(message) original_stdout.flush() + terminal_hook.write_stderr(message) else: original_stderr.write(message) original_stderr.flush() + terminal_hook.write_stdout(message) def flush(self): log_file.flush()