-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
67 lines (51 loc) · 1.75 KB
/
__init__.py
File metadata and controls
67 lines (51 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"""
ComfyUI-FrontendPatches
Fixes core ComfyUI frontend issues that affect custom node development:
- Vue reactivity blindness (slots don't re-render after addInput/removeInput)
- ChangeTracker only knows INPUT/TEXTAREA (breaks CodeMirror, Monaco, etc.)
- LiteGraph event capture (blocks custom UI interaction)
This extension applies patches automatically. Other extensions can use the
JavaScript API for additional control.
See README.md for documentation.
"""
import json
class DynamicInputs:
"""
Demo node showing dynamic inputs working correctly.
This node accepts unlimited connections - each connection spawns a new slot.
Without the Vue reactivity patches, new slots wouldn't render until refresh.
"""
CATEGORY = "FrontendPatches"
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("debug",)
FUNCTION = "execute"
@classmethod
def INPUT_TYPES(cls):
return {
"required": {},
"optional": {}
}
def execute(self, **kwargs):
"""Return debug info about connected inputs."""
state = {
"input_count": len(kwargs),
"inputs": {}
}
for name, value in kwargs.items():
if hasattr(value, 'shape'):
val_repr = f"tensor{list(value.shape)}"
else:
val_repr = str(value)[:100]
state["inputs"][name] = {
"type": type(value).__name__,
"value": val_repr
}
return (json.dumps(state, indent=2),)
NODE_CLASS_MAPPINGS = {
"DynamicInputs": DynamicInputs
}
NODE_DISPLAY_NAME_MAPPINGS = {
"DynamicInputs": "Dynamic Inputs (Demo)"
}
WEB_DIRECTORY = "./web"
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]