trung0246 / comfyui-0246 Goto Github PK
View Code? Open in Web Editor NEWRandom nodes for ComfyUI
License: MIT License
Random nodes for ComfyUI
License: MIT License
The Junction node would be extremely useful if I could connect Reroute nodes to it. Especially rghtree Reroute nodes.
For example, in the following screenshots, I would like to replicate that stack of reversed rgthree Reroute nodes with a single Junction node, but I cannot:
This really is the main use case that triggered my wish list for this node.
Mirror
Junction Plus
Junction
at the top.Merge
to merge Highway
or Junction
together.Filter
.Extract
to extract subset from Highway
or Junction
.Dummy
to ignore and skip some output of Junction
by connecting to it and do nothing else.Hold
to temporary store data and pausing and display what being stored like certain node in another extension. Otherwise acts like Highway
and Junction
and will have two versions for this.Enjoyed your comment
# Hacky way to get the server instance in order to add new api endpoints
server_path = pathlib.Path(__file__).resolve().parent.parent.parent
sys.path.insert(0, str(server_path))
server = __import__("server")
server.PromptServer.instance.app.router.add_post("/0246-parse", parse_handler)
But I found this works:
from server import PromptServer
routes = PromptServer.instance.routes
@routes.post('/0246-parse')
async def parse_handler(request):
# blah blah blah
And seems less likely to be broken by Comfy updates
The current implementation, which allows the user to specify a subset output of the input, gives a massive amount of flexibility. It's great and I'm sure I'll use it in certain circumstances (for example to change the vertical arrangement of the outputs)
But, in most cases, it would be faster and easier to maintain if the Junction node would simply and automatically create an output for every input it receives. Mirroring the list of inputs.
Not sure if this is something that should be done in a separate node (Junction+ ?), or if it could be enabled or disabled via a menu option.
I'm running ComfyUI in a docker container, where it's installed in /app
. Installing this node throws the following error:
comfyui-app-1 | Traceback (most recent call last):
comfyui-app-1 | File "/app/nodes.py", line 1800, in load_custom_node
comfyui-app-1 | module_spec.loader.exec_module(module)
comfyui-app-1 | File "<frozen importlib._bootstrap_external>", line 883, in exec_module
comfyui-app-1 | File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
comfyui-app-1 | File "/app/custom_nodes/ComfyUI-0246/__init__.py", line 1, in <module>
comfyui-app-1 | from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
comfyui-app-1 | File "/app/custom_nodes/ComfyUI-0246/nodes.py", line 23, in <module>
comfyui-app-1 | with utils0246.temp_dir(pathlib.Path(__file__).parent.parent.parent.parent.absolute() / "ComfyUI" / "custom_nodes"):
comfyui-app-1 | File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
comfyui-app-1 | return next(self.gen)
comfyui-app-1 | File "/app/custom_nodes/ComfyUI-0246/utils.py", line 71, in temp_dir
comfyui-app-1 | os.chdir(new_dir)
comfyui-app-1 | FileNotFoundError: [Errno 2] No such file or directory: '/ComfyUI/custom_nodes'
comfyui-app-1 |
comfyui-app-1 | Cannot import /app/custom_nodes/ComfyUI-0246 module for custom nodes: [Errno 2] No such file or directory: '/ComfyUI/custom_nodes'
I believe it's because of this line, which incorrectly assumes the installation directory name:
Line 23 in 272894b
Perhaps instead, you could go up one fewer parents, and then you wouldn't need to know the name of the installation directory?
I finally started testing the Highway and Junction node in a serious way. (I also plan to test the other batch of new ones, which look seriously powerful).
Hence, I remembered one of the reasons why I had to postpone the adoption of either in the AP Workflow: #2.
Without the capability to reverse direction of in and out pins, my workflow would become an unsustainable mess.
That said, while testing the Highway node, I found myself in the situation of attempting to replicate a stack of reroute nodes:
Writing down every label in both directions is a minor annoyance, but it gave me the idea for a tweak of the syntax (if possible).
Right now we write a query like >pinA, <pinA
.
Could we write a query like <>pinA
to shortcut the creation of two in and out pins with identical labels*?
Just a thought.
UPDATE
You have implemented the layout direction! I just didn't notice until now. But, just like for rgthree, when the layout is reversed, the pin labels disappear. Is that a technical limitation of ComfyUI? If so, this whole Issue is mostly pointless.
I just loaded up on a different browser to test some things with another node (tried Chrome and Brave), and I'm getting a client side error. Not sure why I'm not getting it in my usual browser (Safari), though. I haven't used ComfyUI in either of those browsers previously, so I'm not sure if that makes a difference.
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'extra')
at Object.error_flag [as pre] (nodes.js:120:17)
at obj.<computed> [as loadGraphData] (nodes.js:52:16)
at HTMLButtonElement.onclick (ui.js:789:17)
Turns out it's being thrown here:
Line 120 in 6d40ba2
Adding a Highway Node to comfy workflow prevents new images from being added to the queue if the webinterface was not opened in a secure context (HTTPS).
Reproducable using commit #d9d8702 (2023-11-19) for ComfyUI and commit #b7d64ce (2023-11-16) for this extension.
Following error will be reported under Settings โ View Logs
:
TypeError
can't access property "digest", crypto.subtle is undefined
randomSHA256@http://[HOSTNAME]:8188/extensions/ComfyUI-0246/js/nodes.js:41:21
There is no output in command line.
According to MDN: SubtleCrypto, the browser interface crypto.subtle
is not usable from a website without TLS.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
So I tested this again using the webinterface behind a reverse proxy with TLS encryption, which prevented the error from being thrown.
For TLS support I found this related open Issue #1105 and Pull Request #1481 (not provided in aforementioned commit) in ComfyUI repository.
Even if these could solve the current problem, I don't think enabling TLS should be a requirement, especially if ComfyUI isn't exposed to the outside world. Maybe the usage of crypto.subtle
for generating SHA-256 hashes should be replaced by a library. However, I'm not sure which one would be best for this. It's a shame that the Crypto API cannot be used for HTTP pages, even for such small use cases.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.