show input value before the value is interpretated into a real secret (#3364)
This commit is contained in:
@@ -304,7 +304,7 @@ class Settings(BaseSettings):
|
|||||||
SVG_MAX_LENGTH: int = 100000
|
SVG_MAX_LENGTH: int = 100000
|
||||||
|
|
||||||
ENABLE_LOG_ARTIFACTS: bool = False
|
ENABLE_LOG_ARTIFACTS: bool = False
|
||||||
ENABLE_CODE_BLOCK: bool = True
|
ENABLE_CODE_BLOCK: bool = False
|
||||||
|
|
||||||
TASK_BLOCKED_SITE_FALLBACK_URL: str = "https://www.google.com"
|
TASK_BLOCKED_SITE_FALLBACK_URL: str = "https://www.google.com"
|
||||||
|
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ class SkyvernPage:
|
|||||||
status=action_status,
|
status=action_status,
|
||||||
data=data,
|
data=data,
|
||||||
kwargs=kwargs,
|
kwargs=kwargs,
|
||||||
|
call_result=call.result,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Auto-create screenshot artifact after execution
|
# Auto-create screenshot artifact after execution
|
||||||
@@ -190,6 +191,7 @@ class SkyvernPage:
|
|||||||
status: ActionStatus = ActionStatus.pending,
|
status: ActionStatus = ActionStatus.pending,
|
||||||
data: str | dict[str, Any] = "",
|
data: str | dict[str, Any] = "",
|
||||||
kwargs: dict[str, Any] | None = None,
|
kwargs: dict[str, Any] | None = None,
|
||||||
|
call_result: Any | None = None,
|
||||||
) -> Action | None:
|
) -> Action | None:
|
||||||
"""Create an action record in the database before execution if task_id and step_id are available."""
|
"""Create an action record in the database before execution if task_id and step_id are available."""
|
||||||
try:
|
try:
|
||||||
@@ -206,6 +208,7 @@ class SkyvernPage:
|
|||||||
response: str | None = kwargs.get("response")
|
response: str | None = kwargs.get("response")
|
||||||
if not response:
|
if not response:
|
||||||
if action_type == ActionType.INPUT_TEXT:
|
if action_type == ActionType.INPUT_TEXT:
|
||||||
|
text = str(call_result)
|
||||||
response = text
|
response = text
|
||||||
elif action_type == ActionType.SELECT_OPTION:
|
elif action_type == ActionType.SELECT_OPTION:
|
||||||
if select_option:
|
if select_option:
|
||||||
@@ -343,8 +346,8 @@ class SkyvernPage:
|
|||||||
intention: str | None = None,
|
intention: str | None = None,
|
||||||
data: str | dict[str, Any] | None = None,
|
data: str | dict[str, Any] | None = None,
|
||||||
timeout: float = settings.BROWSER_ACTION_TIMEOUT_MS,
|
timeout: float = settings.BROWSER_ACTION_TIMEOUT_MS,
|
||||||
) -> None:
|
) -> str:
|
||||||
await self._input_text(xpath, value, ai_infer, intention, data, timeout)
|
return await self._input_text(xpath, value, ai_infer, intention, data, timeout)
|
||||||
|
|
||||||
@action_wrap(ActionType.INPUT_TEXT)
|
@action_wrap(ActionType.INPUT_TEXT)
|
||||||
async def type(
|
async def type(
|
||||||
@@ -355,8 +358,8 @@ class SkyvernPage:
|
|||||||
intention: str | None = None,
|
intention: str | None = None,
|
||||||
data: str | dict[str, Any] | None = None,
|
data: str | dict[str, Any] | None = None,
|
||||||
timeout: float = settings.BROWSER_ACTION_TIMEOUT_MS,
|
timeout: float = settings.BROWSER_ACTION_TIMEOUT_MS,
|
||||||
) -> None:
|
) -> str:
|
||||||
await self._input_text(xpath, value, ai_infer, intention, data, timeout)
|
return await self._input_text(xpath, value, ai_infer, intention, data, timeout)
|
||||||
|
|
||||||
async def _input_text(
|
async def _input_text(
|
||||||
self,
|
self,
|
||||||
@@ -366,7 +369,7 @@ class SkyvernPage:
|
|||||||
intention: str | None = None,
|
intention: str | None = None,
|
||||||
data: str | dict[str, Any] | None = None,
|
data: str | dict[str, Any] | None = None,
|
||||||
timeout: float = settings.BROWSER_ACTION_TIMEOUT_MS,
|
timeout: float = settings.BROWSER_ACTION_TIMEOUT_MS,
|
||||||
) -> None:
|
) -> str:
|
||||||
"""Input text into an element identified by ``xpath``.
|
"""Input text into an element identified by ``xpath``.
|
||||||
|
|
||||||
When ``intention`` and ``data`` are provided a new input text action is
|
When ``intention`` and ``data`` are provided a new input text action is
|
||||||
@@ -380,6 +383,7 @@ class SkyvernPage:
|
|||||||
# format the text with the actual value of the parameter if it's a secret when running a workflow
|
# format the text with the actual value of the parameter if it's a secret when running a workflow
|
||||||
context = skyvern_context.current()
|
context = skyvern_context.current()
|
||||||
value = value or ""
|
value = value or ""
|
||||||
|
transformed_value = value
|
||||||
if ai_infer and intention:
|
if ai_infer and intention:
|
||||||
try:
|
try:
|
||||||
prompt = context.prompt if context else None
|
prompt = context.prompt if context else None
|
||||||
@@ -402,10 +406,11 @@ class SkyvernPage:
|
|||||||
LOG.exception(f"Failed to adapt value for input text action on xpath={xpath}, value={value}")
|
LOG.exception(f"Failed to adapt value for input text action on xpath={xpath}, value={value}")
|
||||||
|
|
||||||
if context and context.workflow_run_id:
|
if context and context.workflow_run_id:
|
||||||
value = await _get_actual_value_of_parameter_if_secret(context.workflow_run_id, value)
|
transformed_value = await _get_actual_value_of_parameter_if_secret(context.workflow_run_id, value)
|
||||||
|
|
||||||
locator = self.page.locator(f"xpath={xpath}")
|
locator = self.page.locator(f"xpath={xpath}")
|
||||||
await handler_utils.input_sequentially(locator, value, timeout=timeout)
|
await handler_utils.input_sequentially(locator, transformed_value, timeout=timeout)
|
||||||
|
return value
|
||||||
|
|
||||||
@action_wrap(ActionType.UPLOAD_FILE)
|
@action_wrap(ActionType.UPLOAD_FILE)
|
||||||
async def upload_file(
|
async def upload_file(
|
||||||
|
|||||||
Reference in New Issue
Block a user