WIP - Loop node advanced parameters + complete_if_empty (#1675)

This commit is contained in:
Shuchang Zheng
2025-01-30 03:40:25 +08:00
committed by GitHub
parent 2166ab129b
commit 5e4b86c828
3 changed files with 7 additions and 1 deletions

View File

@@ -765,6 +765,7 @@ class ForLoopBlock(Block):
loop_blocks: list[BlockTypeVar]
loop_over: PARAMETER_TYPE | None = None
loop_variable_reference: str | None = None
complete_if_empty: bool = False
def get_all_parameters(
self,
@@ -849,7 +850,10 @@ class ForLoopBlock(Block):
raise NotImplementedError()
else:
raise NoIterableValueFound()
if self.complete_if_empty:
return []
else:
raise NoIterableValueFound()
if isinstance(parameter_value, list):
return parameter_value

View File

@@ -146,6 +146,7 @@ class ForLoopBlockYAML(BlockYAML):
loop_blocks: list["BLOCK_YAML_SUBCLASSES"]
loop_over_parameter_key: str = ""
loop_variable_reference: str | None = None
complete_if_empty: bool = False
class CodeBlockYAML(BlockYAML):

View File

@@ -1512,6 +1512,7 @@ class WorkflowService:
loop_blocks=loop_blocks,
output_parameter=output_parameter,
continue_on_failure=block_yaml.continue_on_failure,
complete_if_empty=block_yaml.complete_if_empty,
)
elif block_yaml.block_type == BlockType.CODE:
return CodeBlock(