mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-20 19:42:59 +08:00
Create test nodes for Autogrow to collab with frontend development
This commit is contained in:
parent
712e61d535
commit
bbc3ecd1b1
@ -842,7 +842,7 @@ class DynamicOutput(Output, ABC):
|
||||
|
||||
@comfytype(io_type="COMFY_AUTOGROW_V3")
|
||||
class Autogrow(ComfyTypeI):
|
||||
Type = list[Any]
|
||||
Type = dict[str, Any]
|
||||
_MaxNames = 100 # NOTE: max 100 names for sanity
|
||||
|
||||
class _AutogrowTemplate:
|
||||
@ -1872,6 +1872,7 @@ __all__ = [
|
||||
# Dynamic Types
|
||||
"MatchType",
|
||||
"DynamicCombo",
|
||||
"Autogrow",
|
||||
# Other classes
|
||||
"HiddenHolder",
|
||||
"Hidden",
|
||||
|
||||
@ -57,7 +57,7 @@ class DCTestNode(io.ComfyNode):
|
||||
)],
|
||||
outputs=[io.AnyType.Output()],
|
||||
)
|
||||
|
||||
|
||||
@classmethod
|
||||
def execute(cls, combo: DCValues) -> io.NodeOutput:
|
||||
combo_val = combo["combo"]
|
||||
@ -71,12 +71,54 @@ class DCTestNode(io.ComfyNode):
|
||||
raise ValueError(f"Invalid combo: {combo_val}")
|
||||
|
||||
|
||||
class AutogrowNamesTestNode(io.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
template = io.Autogrow.TemplateNames(input=io.String.Input("string"), names=["a", "b", "c"])
|
||||
return io.Schema(
|
||||
node_id="AutogrowNamesTestNode",
|
||||
display_name="AutogrowNamesTest",
|
||||
category="logic",
|
||||
inputs=[
|
||||
io.Autogrow.Input("autogrow", template=template)
|
||||
],
|
||||
outputs=[io.String.Output("output")],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, autogrow: io.Autogrow.Type) -> io.NodeOutput:
|
||||
vals = list(autogrow.values())
|
||||
combined = "".join(vals)
|
||||
return io.NodeOutput(combined)
|
||||
|
||||
class AutogrowPrefixTestNode(io.ComfyNode):
|
||||
@classmethod
|
||||
def define_schema(cls):
|
||||
template = io.Autogrow.TemplatePrefix(input=io.String.Input("string"), prefix="string", min=1, max=10)
|
||||
return io.Schema(
|
||||
node_id="AutogrowPrefixTestNode",
|
||||
display_name="AutogrowPrefixTest",
|
||||
category="logic",
|
||||
inputs=[
|
||||
io.Autogrow.Input("autogrow", template=template)
|
||||
],
|
||||
outputs=[io.String.Output("output")],
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, autogrow: io.Autogrow.Type) -> io.NodeOutput:
|
||||
vals = list(autogrow.values())
|
||||
combined = "".join(vals)
|
||||
return io.NodeOutput(combined)
|
||||
|
||||
class LogicExtension(ComfyExtension):
|
||||
@override
|
||||
async def get_node_list(self) -> list[type[io.ComfyNode]]:
|
||||
return [
|
||||
SwitchNode,
|
||||
DCTestNode,
|
||||
AutogrowNamesTestNode,
|
||||
AutogrowPrefixTestNode,
|
||||
]
|
||||
|
||||
async def comfy_entrypoint() -> LogicExtension:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user