current viewpoint screenshot and scrolling n screenshot (#2716)

Co-authored-by: lawyzheng <lawyzheng1106@gmail.com>
This commit is contained in:
Shuchang Zheng
2025-06-13 23:59:50 -07:00
committed by GitHub
parent 11288817af
commit 775da18878
39 changed files with 452 additions and 35 deletions

View File

@@ -67,6 +67,7 @@ async def get_run_response(run_id: str, organization_id: str | None = None) -> R
max_steps=task_v1_response.max_steps_per_run,
data_extraction_schema=task_v1_response.request.extracted_information_schema,
error_code_mapping=task_v1_response.request.error_code_mapping,
max_screenshot_scrolling_times=task_v1_response.request.max_screenshot_scrolling_times,
),
)
elif run.task_run_type == RunType.task_v2:

View File

@@ -165,6 +165,7 @@ async def initialize_task_v2(
error_code_mapping: dict | None = None,
create_task_run: bool = False,
model: dict[str, Any] | None = None,
max_screenshot_scrolling_times: int | None = None,
) -> TaskV2:
task_v2 = await app.DATABASE.create_task_v2(
prompt=user_prompt,
@@ -176,11 +177,13 @@ async def initialize_task_v2(
extracted_information_schema=extracted_information_schema,
error_code_mapping=error_code_mapping,
model=model,
max_screenshot_scrolling_times=max_screenshot_scrolling_times,
)
# set task_v2_id in context
context = skyvern_context.current()
if context:
context.task_v2_id = task_v2.observer_cruise_id
context.max_screenshot_scrolling_times = max_screenshot_scrolling_times
thought = await app.DATABASE.create_thought(
task_v2_id=task_v2.observer_cruise_id,
@@ -221,7 +224,9 @@ async def initialize_task_v2(
)
workflow_run = await app.WORKFLOW_SERVICE.setup_workflow_run(
request_id=None,
workflow_request=WorkflowRequestBody(),
workflow_request=WorkflowRequestBody(
max_screenshot_scrolling_times=max_screenshot_scrolling_times,
),
workflow_permanent_id=new_workflow.workflow_permanent_id,
organization=organization,
version=None,
@@ -454,6 +459,7 @@ async def run_task_v2_helper(
request_id=request_id,
task_v2_id=task_v2_id,
browser_session_id=browser_session_id,
max_screenshot_scrolling_times=task_v2.max_screenshot_scrolling_times,
)
)
@@ -771,6 +777,7 @@ async def run_task_v2_helper(
proxy_location=task_v2.proxy_location or ProxyLocation.RESIDENTIAL,
workflow_definition=workflow_definition_yaml,
status=workflow.status,
max_screenshot_scrolling_times=task_v2.max_screenshot_scrolling_times,
)
LOG.info("Creating workflow from request", workflow_create_request=workflow_create_request)
workflow = await app.WORKFLOW_SERVICE.create_workflow_from_request(

View File

@@ -97,6 +97,7 @@ async def get_workflow_run_response(
webhook_url=workflow_run.webhook_callback_url or None,
totp_url=workflow_run.totp_verification_url or None,
totp_identifier=workflow_run.totp_identifier,
max_screenshot_scrolling_times=workflow_run.max_screenshot_scrolling_times,
# TODO: add browser session id
),
)