Jon/backend hitl buffs (#3826)
This commit is contained in:
@@ -3099,6 +3099,14 @@ class HumanInteractionBlock(BaseTaskBlock):
|
||||
|
||||
self.recipients = formatted
|
||||
|
||||
self.negative_descriptor = self.format_block_parameter_template_from_workflow_run_context(
|
||||
self.negative_descriptor, workflow_run_context
|
||||
)
|
||||
|
||||
self.positive_descriptor = self.format_block_parameter_template_from_workflow_run_context(
|
||||
self.positive_descriptor, workflow_run_context
|
||||
)
|
||||
|
||||
async def execute(
|
||||
self,
|
||||
workflow_run_id: str,
|
||||
@@ -3110,6 +3118,31 @@ class HumanInteractionBlock(BaseTaskBlock):
|
||||
# avoid circular import
|
||||
from skyvern.forge.sdk.workflow.models.workflow import WorkflowRunStatus # noqa: PLC0415
|
||||
|
||||
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,
|
||||
)
|
||||
|
||||
await app.DATABASE.update_workflow_run_block(
|
||||
workflow_run_block_id=workflow_run_block_id,
|
||||
organization_id=organization_id,
|
||||
recipients=self.recipients,
|
||||
subject=self.subject,
|
||||
body=self.body,
|
||||
instructions=self.instructions,
|
||||
positive_descriptor=self.positive_descriptor,
|
||||
negative_descriptor=self.negative_descriptor,
|
||||
)
|
||||
|
||||
LOG.info(
|
||||
"Pausing workflow for human interaction",
|
||||
workflow_run_id=workflow_run_id,
|
||||
@@ -3138,20 +3171,6 @@ class HumanInteractionBlock(BaseTaskBlock):
|
||||
organization_id=organization_id,
|
||||
)
|
||||
|
||||
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,
|
||||
)
|
||||
|
||||
workflow_permanent_id = workflow_run.workflow_permanent_id
|
||||
app_url = f"{settings.SKYVERN_APP_URL}/workflows/{workflow_permanent_id}/{workflow_run_id}/overview"
|
||||
body = f"{self.body}\n\nKindly visit {app_url}\n\n{self.instructions}\n\n"
|
||||
|
||||
Reference in New Issue
Block a user