Create test nodes for Autogrow to collab with frontend development

This commit is contained in:
Jedrzej Kosinski 2025-11-18 04:43:52 -08:00
parent 712e61d535
commit bbc3ecd1b1
2 changed files with 45 additions and 2 deletions

View File

@ -842,7 +842,7 @@ class DynamicOutput(Output, ABC):
@comfytype(io_type="COMFY_AUTOGROW_V3") @comfytype(io_type="COMFY_AUTOGROW_V3")
class Autogrow(ComfyTypeI): class Autogrow(ComfyTypeI):
Type = list[Any] Type = dict[str, Any]
_MaxNames = 100 # NOTE: max 100 names for sanity _MaxNames = 100 # NOTE: max 100 names for sanity
class _AutogrowTemplate: class _AutogrowTemplate:
@ -1872,6 +1872,7 @@ __all__ = [
# Dynamic Types # Dynamic Types
"MatchType", "MatchType",
"DynamicCombo", "DynamicCombo",
"Autogrow",
# Other classes # Other classes
"HiddenHolder", "HiddenHolder",
"Hidden", "Hidden",

View File

@ -71,12 +71,54 @@ class DCTestNode(io.ComfyNode):
raise ValueError(f"Invalid combo: {combo_val}") 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): class LogicExtension(ComfyExtension):
@override @override
async def get_node_list(self) -> list[type[io.ComfyNode]]: async def get_node_list(self) -> list[type[io.ComfyNode]]:
return [ return [
SwitchNode, SwitchNode,
DCTestNode, DCTestNode,
AutogrowNamesTestNode,
AutogrowPrefixTestNode,
] ]
async def comfy_entrypoint() -> LogicExtension: async def comfy_entrypoint() -> LogicExtension: