mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(simulator): generate default values for input blocks in dry-run
When users click Simulate without providing input values,
AgentInputBlock.value is None and nothing gets yielded. This leaves
downstream blocks (like OrchestratorBlock) with unpopulated links,
causing them to be skipped entirely.
Fix: generate a sensible default — first dropdown option for
AgentDropdownInputBlock, or "sample {name}" for text inputs.
This commit is contained in:
@@ -395,8 +395,16 @@ async def simulate_block(
|
||||
# AgentFileInputBlock, AgentShortTextInputBlock, etc.) yield
|
||||
# "result" with the provided value.
|
||||
value = input_data.get("value")
|
||||
if value is not None:
|
||||
yield "result", value
|
||||
if value is None:
|
||||
# Dry-run with no user input: generate a sensible default so
|
||||
# downstream blocks (e.g. OrchestratorBlock) still receive data.
|
||||
placeholder = input_data.get("placeholder_values")
|
||||
if placeholder and isinstance(placeholder, list) and placeholder:
|
||||
value = placeholder[0] # First dropdown option
|
||||
else:
|
||||
name = input_data.get("name", "input")
|
||||
value = f"sample {name}"
|
||||
yield "result", value
|
||||
return
|
||||
|
||||
if isinstance(block, AgentOutputBlock):
|
||||
|
||||
Reference in New Issue
Block a user