update static block

This commit is contained in:
SwiftyOS
2024-09-26 10:10:52 +02:00
parent b4097f3a51
commit ac246c476c

View File

@@ -19,14 +19,12 @@ class StoreValueBlock(Block):
"""
class Input(BlockSchema):
input: Any = Field(
description="Trigger the block to produce the output. "
"The value is only used when `data` is None."
trigger: Any = SchemaField(
description="Trigger the block to produce the output. Passed value is never used."
)
data: Any = Field(
value: Any = SchemaField(
description="The constant data to be retained in the block. "
"This value is passed as `output`.",
default=None,
)
class Output(BlockSchema):
@@ -35,23 +33,21 @@ class StoreValueBlock(Block):
def __init__(self):
super().__init__(
id="1ff065e9-88e8-4358-9d82-8dc91f622ba9",
description="This block forwards an input value as output, allowing reuse without change.",
description="This is a special block that provides a value when triggered. The value can be reused multiple times.",
categories={BlockCategory.BASIC},
input_schema=StoreValueBlock.Input,
output_schema=StoreValueBlock.Output,
test_input=[
{"input": "Hello, World!"},
{"input": "Hello, World!", "data": "Existing Data"},
{"input": "Hello, World!", "value": "Existing Data"},
],
test_output=[
("output", "Hello, World!"), # No data provided, so trigger is returned
("output", "Existing Data"), # Data is provided, so data is returned.
("output", "Existing Data"),
],
static_output=True,
)
def run(self, input_data: Input, **kwargs) -> BlockOutput:
yield "output", input_data.data or input_data.input
yield "output", input_data.value
class PrintToConsoleBlock(Block):