mirror of
https://git.datalinker.icu/ltdrdata/ComfyUI-Manager
synced 2025-12-09 22:24:23 +08:00
terminal feature is removed.
Now ComfyUI provides built-in terminal feature. https://github.com/comfyanonymous/ComfyUI/pull/5413
This commit is contained in:
parent
0a9a8e418b
commit
294244b99f
@ -363,7 +363,6 @@ When you run the `scan.sh` script:
|
|||||||
* `high` level risky features
|
* `high` level risky features
|
||||||
* `Install via git url`, `pip install`
|
* `Install via git url`, `pip install`
|
||||||
* Installation of custom nodes registered not in the `default channel`.
|
* Installation of custom nodes registered not in the `default channel`.
|
||||||
* Display terminal log
|
|
||||||
* Fix custom nodes
|
* Fix custom nodes
|
||||||
|
|
||||||
* `middle` level risky features
|
* `middle` level risky features
|
||||||
|
|||||||
@ -23,7 +23,7 @@ sys.path.append(glob_path)
|
|||||||
import cm_global
|
import cm_global
|
||||||
from manager_util import *
|
from manager_util import *
|
||||||
|
|
||||||
version = [2, 51, 8]
|
version = [2, 51, 9]
|
||||||
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')
|
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1070,32 +1070,6 @@ async def install_model(request):
|
|||||||
return web.Response(status=400)
|
return web.Response(status=400)
|
||||||
|
|
||||||
|
|
||||||
class ManagerTerminalHook:
|
|
||||||
def write_stderr(self, msg):
|
|
||||||
PromptServer.instance.send_sync("manager-terminal-feedback", {"data": msg})
|
|
||||||
|
|
||||||
def write_stdout(self, msg):
|
|
||||||
PromptServer.instance.send_sync("manager-terminal-feedback", {"data": msg})
|
|
||||||
|
|
||||||
|
|
||||||
manager_terminal_hook = ManagerTerminalHook()
|
|
||||||
|
|
||||||
|
|
||||||
@PromptServer.instance.routes.get("/manager/terminal")
|
|
||||||
async def terminal_mode(request):
|
|
||||||
if not is_allowed_security_level('high'):
|
|
||||||
print(SECURITY_MESSAGE_NORMAL_MINUS)
|
|
||||||
return web.Response(status=403)
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
@PromptServer.instance.routes.get("/manager/preview_method")
|
@PromptServer.instance.routes.get("/manager/preview_method")
|
||||||
async def preview_method(request):
|
async def preview_method(request):
|
||||||
if "value" in request.rel_url.query:
|
if "value" in request.rel_url.query:
|
||||||
@ -1372,6 +1346,6 @@ if not os.path.exists(core.config_path):
|
|||||||
cm_global.register_extension('ComfyUI-Manager',
|
cm_global.register_extension('ComfyUI-Manager',
|
||||||
{'version': core.version,
|
{'version': core.version,
|
||||||
'name': 'ComfyUI Manager',
|
'name': 'ComfyUI Manager',
|
||||||
'nodes': {'Terminal Log //CM'},
|
'nodes': {},
|
||||||
'description': 'It provides the ability to manage custom nodes in ComfyUI.', })
|
'description': 'It provides the ability to manage custom nodes in ComfyUI.', })
|
||||||
|
|
||||||
|
|||||||
@ -1,83 +0,0 @@
|
|||||||
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 extends LiteGraph.LGraphNode {
|
|
||||||
color = "#222222";
|
|
||||||
bgcolor = "#000000";
|
|
||||||
groupcolor = LGraphCanvas.node_colors.black.groupcolor;
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.title = "Terminal Log (Manager)";
|
|
||||||
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",
|
|
||||||
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);
|
|
||||||
@ -98,36 +98,6 @@ def remap_pip_package(pkg):
|
|||||||
std_log_lock = threading.Lock()
|
std_log_lock = threading.Lock()
|
||||||
|
|
||||||
|
|
||||||
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):
|
def handle_stream(stream, prefix):
|
||||||
stream.reconfigure(encoding=locale.getpreferredencoding(), errors='replace')
|
stream.reconfigure(encoding=locale.getpreferredencoding(), errors='replace')
|
||||||
for msg in stream:
|
for msg in stream:
|
||||||
@ -270,11 +240,9 @@ try:
|
|||||||
if self.is_stdout:
|
if self.is_stdout:
|
||||||
write_stdout(message)
|
write_stdout(message)
|
||||||
original_stdout.flush()
|
original_stdout.flush()
|
||||||
terminal_hook.write_stderr(message)
|
|
||||||
else:
|
else:
|
||||||
write_stderr(message)
|
write_stderr(message)
|
||||||
original_stderr.flush()
|
original_stderr.flush()
|
||||||
terminal_hook.write_stdout(message)
|
|
||||||
|
|
||||||
def flush(self):
|
def flush(self):
|
||||||
log_file.flush()
|
log_file.flush()
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "comfyui-manager"
|
name = "comfyui-manager"
|
||||||
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
|
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
|
||||||
version = "2.51.8"
|
version = "2.51.9"
|
||||||
license = { file = "LICENSE.txt" }
|
license = { file = "LICENSE.txt" }
|
||||||
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]
|
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user