Script action - store text and option (#3289)

This commit is contained in:
Shuchang Zheng
2025-08-24 17:34:31 -07:00
committed by GitHub
parent f3167ed2a3
commit 472b8b4452
3 changed files with 29 additions and 5 deletions

View File

@@ -555,12 +555,15 @@ def convert_to_script_block(script_block_model: ScriptBlockModel) -> ScriptBlock
)
def hydrate_action(action_model: ActionModel) -> Action:
def hydrate_action(action_model: ActionModel, empty_element_id: bool = False) -> Action:
"""
Convert ActionModel to the appropriate Action type based on action_type.
The action_json contains all the metadata of different types of actions.
"""
# Create base action data from the model
element_id = action_model.element_id
if empty_element_id:
element_id = element_id or ""
action_data = {
"action_type": action_model.action_type,
"status": action_model.status,
@@ -576,7 +579,7 @@ def hydrate_action(action_model: ActionModel) -> Action:
"reasoning": action_model.reasoning,
"intention": action_model.intention,
"response": action_model.response,
"element_id": action_model.element_id,
"element_id": element_id,
"skyvern_element_hash": action_model.skyvern_element_hash,
"skyvern_element_data": action_model.skyvern_element_data,
"created_at": action_model.created_at,