mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2025-09-14 17:29:40 +00:00
task v2 support jinja style (#1978)
This commit is contained in:
parent
b90ae3b30c
commit
ea906e2f7c
1 changed files with 29 additions and 0 deletions
|
@ -2229,6 +2229,22 @@ class TaskV2Block(Block):
|
|||
) -> list[PARAMETER_TYPE]:
|
||||
return []
|
||||
|
||||
def format_potential_template_parameters(self, workflow_run_context: WorkflowRunContext) -> None:
|
||||
self.prompt = self.format_block_parameter_template_from_workflow_run_context(self.prompt, workflow_run_context)
|
||||
if self.url:
|
||||
self.url = self.format_block_parameter_template_from_workflow_run_context(self.url, workflow_run_context)
|
||||
|
||||
if self.totp_identifier:
|
||||
self.totp_identifier = self.format_block_parameter_template_from_workflow_run_context(
|
||||
self.totp_identifier, workflow_run_context
|
||||
)
|
||||
|
||||
if self.totp_verification_url:
|
||||
self.totp_verification_url = self.format_block_parameter_template_from_workflow_run_context(
|
||||
self.totp_verification_url, workflow_run_context
|
||||
)
|
||||
self.totp_verification_url = prepend_scheme_and_validate_url(self.totp_verification_url)
|
||||
|
||||
async def execute(
|
||||
self,
|
||||
workflow_run_id: str,
|
||||
|
@ -2240,6 +2256,19 @@ class TaskV2Block(Block):
|
|||
from skyvern.forge.sdk.services import task_v2_service
|
||||
from skyvern.forge.sdk.workflow.models.workflow import WorkflowRunStatus
|
||||
|
||||
workflow_run_context = self.get_workflow_run_context(workflow_run_id)
|
||||
try:
|
||||
self.format_potential_template_parameters(workflow_run_context)
|
||||
except Exception as e:
|
||||
return await self.build_block_result(
|
||||
success=False,
|
||||
failure_reason=f"Failed to format jinja template: {str(e)}",
|
||||
output_parameter_value=None,
|
||||
status=BlockStatus.failed,
|
||||
workflow_run_block_id=workflow_run_block_id,
|
||||
organization_id=organization_id,
|
||||
)
|
||||
|
||||
if not self.url:
|
||||
browser_state = app.BROWSER_MANAGER.get_for_workflow_run(workflow_run_id)
|
||||
if browser_state:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue