add ClickContext to support click action ai="fallback" in generated code (#3892)
This commit is contained in:
@@ -50,6 +50,11 @@ class InputOrSelectContext(BaseModel):
|
||||
return f"InputOrSelectContext(field={self.field}, is_required={self.is_required}, is_search_bar={self.is_search_bar}, is_location_input={self.is_location_input}, intention={self.intention})"
|
||||
|
||||
|
||||
class ClickContext(BaseModel):
|
||||
thought: str | None = None
|
||||
single_option_click: bool | None = None
|
||||
|
||||
|
||||
class Action(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -88,6 +93,7 @@ class Action(BaseModel):
|
||||
option: SelectOption | None = None
|
||||
is_checked: bool | None = None
|
||||
verified: bool = False
|
||||
click_context: ClickContext | None = None
|
||||
|
||||
# TOTP timing information for multi-field TOTP sequences
|
||||
totp_timing_info: dict[str, Any] | None = None
|
||||
|
||||
@@ -21,6 +21,7 @@ from skyvern.webeye.actions.actions import (
|
||||
Action,
|
||||
CheckboxAction,
|
||||
ClickAction,
|
||||
ClickContext,
|
||||
ClosePageAction,
|
||||
CompleteAction,
|
||||
DownloadFileAction,
|
||||
@@ -97,7 +98,15 @@ def parse_action(
|
||||
|
||||
if action_type == ActionType.CLICK:
|
||||
file_url = action["file_url"] if "file_url" in action else None
|
||||
return ClickAction(**base_action_dict, file_url=file_url, download=action.get("download", False))
|
||||
click_context = action.get("click_context", None)
|
||||
if click_context:
|
||||
click_context = ClickContext.model_validate(click_context)
|
||||
return ClickAction(
|
||||
**base_action_dict,
|
||||
file_url=file_url,
|
||||
download=action.get("download", False),
|
||||
click_context=click_context,
|
||||
)
|
||||
|
||||
if action_type == ActionType.INPUT_TEXT:
|
||||
context_dict = action.get("context", {})
|
||||
|
||||
Reference in New Issue
Block a user