Skip to content

Commit

Permalink
🔄 synced local 'skyvern/' with remote 'skyvern/'
Browse files Browse the repository at this point in the history
<!-- ELLIPSIS_HIDDEN -->

> [!IMPORTANT]
> Fix handling of non-link loop values in `_generate_loop_task()` in `observer_service.py` by ensuring `ContextParameter` is created for both link and non-link loop values.
>
>   - **Behavior**:
>     - Fix handling of non-link loop values in `_generate_loop_task()` in `observer_service.py` by ensuring `ContextParameter` is created for both link and non-link loop values.
>   - **Logging**:
>     - Remove redundant logging of "Workflow found" in `run_observer_cruise_helper()` in `observer_service.py`.
>
> <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=Skyvern-AI%2Fskyvern-cloud&utm_source=github&utm_medium=referral)<sup> for b116f2feeb339f966803cf5e7152e78079928211. It will automatically update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->
  • Loading branch information
wintonzheng committed Jan 2, 2025
1 parent face695 commit 0573a72
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions skyvern/forge/sdk/services/observer_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,6 @@ async def run_observer_cruise_helper(
if not workflow:
LOG.error("Workflow not found", workflow_id=workflow_id)
return None, None
else:
LOG.info("Workflow found", workflow_id=workflow_id)

###################### run observer ######################

Expand Down Expand Up @@ -748,27 +746,31 @@ async def _generate_loop_task(
task_parameters: list[PARAMETER_TYPE] = []
if output_value_obj.is_loop_value_link:
LOG.info("Loop values are links", loop_values=output_value_obj.loop_values)
# create ContextParameter for the value
url_value_context_parameter = ContextParameter(
key="task_in_loop_url",
source=loop_for_context_parameter,
)
task_parameters.append(url_value_context_parameter)
for_loop_parameter_yaml_list.append(
ContextParameterYAML(
key=url_value_context_parameter.key,
description=url_value_context_parameter.description,
source_parameter_key=loop_for_context_parameter.key,
)
)
app.WORKFLOW_CONTEXT_MANAGER.add_context_parameter(workflow_run_id, url_value_context_parameter)
url = "task_in_loop_url"
context_parameter_key = "task_in_loop_url"
else:
LOG.info("Loop values are not links", loop_values=output_value_obj.loop_values)
page = await browser_state.get_working_page()
url = str(
await SkyvernFrame.evaluate(frame=page, expression="() => document.location.href") if page else original_url
)
context_parameter_key = "target"

# create ContextParameter for the value
url_value_context_parameter = ContextParameter(
key=context_parameter_key,
source=loop_for_context_parameter,
)
task_parameters.append(url_value_context_parameter)
for_loop_parameter_yaml_list.append(
ContextParameterYAML(
key=url_value_context_parameter.key,
description=url_value_context_parameter.description,
source_parameter_key=loop_for_context_parameter.key,
)
)
app.WORKFLOW_CONTEXT_MANAGER.add_context_parameter(workflow_run_id, url_value_context_parameter)

task_in_loop_label = f"task_in_loop_{_generate_random_string()}"
context = skyvern_context.ensure_context()
task_in_loop_metadata_prompt = prompt_engine.load_prompt(
Expand Down

0 comments on commit 0573a72

Please sign in to comment.