script gen bug - fix parameters input for non task blocks (#3683)

This commit is contained in:
Shuchang Zheng
2025-10-10 12:47:54 -07:00
committed by GitHub
parent ae7785d426
commit 89c712786d
2 changed files with 47 additions and 28 deletions

View File

@@ -944,6 +944,9 @@ def _build_goto_statement(block: dict[str, Any], data_variable_name: str | None
def _build_code_statement(block: dict[str, Any]) -> cst.SimpleStatementLine:
"""Build a skyvern.run_code statement."""
parameters = block.get("parameters", [])
parameter_list = [parameter["key"] for parameter in parameters]
args = [
cst.Arg(
keyword=cst.Name("code"),
@@ -963,7 +966,7 @@ def _build_code_statement(block: dict[str, Any]) -> cst.SimpleStatementLine:
),
cst.Arg(
keyword=cst.Name("parameters"),
value=_value(block.get("parameters", None)),
value=_value(parameter_list),
whitespace_after_arg=cst.ParenthesizedWhitespace(
indent=True,
),
@@ -985,6 +988,9 @@ def _build_code_statement(block: dict[str, Any]) -> cst.SimpleStatementLine:
def _build_file_upload_statement(block: dict[str, Any]) -> cst.SimpleStatementLine:
"""Build a skyvern.upload_file statement."""
parameters = block.get("parameters", [])
parameter_list = [parameter["key"] for parameter in parameters]
args = [
cst.Arg(
keyword=cst.Name("label"),
@@ -996,7 +1002,7 @@ def _build_file_upload_statement(block: dict[str, Any]) -> cst.SimpleStatementLi
),
cst.Arg(
keyword=cst.Name("parameters"),
value=_value(block.get("parameters", None)),
value=_value(parameter_list),
whitespace_after_arg=cst.ParenthesizedWhitespace(
indent=True,
last_line=cst.SimpleWhitespace(INDENT),
@@ -1289,10 +1295,12 @@ def _build_prompt_statement(block: dict[str, Any]) -> cst.SimpleStatementLine:
)
if block.get("parameters") is not None:
parameters = block.get("parameters", [])
parameter_list = [parameter["key"] for parameter in parameters]
args.append(
cst.Arg(
keyword=cst.Name("parameters"),
value=_value(block.get("parameters")),
value=_value(parameter_list),
whitespace_after_arg=cst.ParenthesizedWhitespace(
indent=True,
),