migrate generate_script -> run_with (BE) (#3550)

This commit is contained in:
Jonathan Dobson
2025-09-29 15:14:15 -04:00
committed by GitHub
parent e04f81fcda
commit 2a3cc647a5
10 changed files with 63 additions and 33 deletions

View File

@@ -154,7 +154,7 @@ async def initialize_task_v2(
totp_identifier: str | None = None,
totp_verification_url: str | None = None,
webhook_callback_url: str | None = None,
publish_workflow: bool = False,
publish_workflow: bool = True,
parent_workflow_run_id: str | None = None,
extracted_information_schema: dict | list | str | None = None,
error_code_mapping: dict | None = None,
@@ -164,11 +164,8 @@ async def initialize_task_v2(
browser_session_id: str | None = None,
extra_http_headers: dict[str, str] | None = None,
browser_address: str | None = None,
generate_script: bool = False,
run_with: str | None = None,
) -> TaskV2:
if generate_script:
publish_workflow = True
task_v2 = await app.DATABASE.create_task_v2(
prompt=user_prompt,
organization_id=organization.organization_id,
@@ -182,7 +179,7 @@ async def initialize_task_v2(
max_screenshot_scrolling_times=max_screenshot_scrolling_times,
extra_http_headers=extra_http_headers,
browser_address=browser_address,
generate_script=generate_script,
run_with=run_with,
)
# set task_v2_id in context
context = skyvern_context.current()
@@ -229,7 +226,7 @@ async def initialize_task_v2(
status=workflow_status,
max_screenshot_scrolling_times=max_screenshot_scrolling_times,
extra_http_headers=extra_http_headers,
generate_script=generate_script,
run_with=run_with,
)
workflow_run = await app.WORKFLOW_SERVICE.setup_workflow_run(
request_id=None,
@@ -901,7 +898,7 @@ async def run_task_v2_helper(
context=context,
screenshots=completion_screenshots,
)
if task_v2.generate_script:
if task_v2.run_with == "code": # TODO(jdo): not sure about this one...
await app.WORKFLOW_SERVICE.generate_script_if_needed(
workflow=workflow,
workflow_run=workflow_run,