mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(backend): guard against None name in _default_for_input_result
When name key exists with explicit None value, _default_for_input_result would return None for string-typed pins instead of a string. Add fallback to "sample input" and fix the type hint to reflect nullable.
This commit is contained in:
@@ -370,7 +370,7 @@ def get_dry_run_credentials(
|
||||
return None
|
||||
|
||||
|
||||
def _default_for_input_result(result_schema: dict[str, Any], name: str) -> Any:
|
||||
def _default_for_input_result(result_schema: dict[str, Any], name: str | None) -> Any:
|
||||
"""Return a type-appropriate sample value for an AgentInputBlock's result pin.
|
||||
|
||||
Typed subclasses (AgentNumberInputBlock, AgentDateInputBlock, etc.)
|
||||
@@ -398,7 +398,7 @@ def _default_for_input_result(result_schema: dict[str, Any], name: str) -> Any:
|
||||
if fmt == "time":
|
||||
return "00:00:00"
|
||||
# Default: use the block's name as a sample string.
|
||||
return name
|
||||
return name or "sample input"
|
||||
|
||||
|
||||
async def simulate_block(
|
||||
|
||||
Reference in New Issue
Block a user