Skip to content

Automate browser based workflows with AI

Add 'value' to data (navigation payload) in AI prompts (#3902)

Stanislav Novosad0ad6a7c0bd0d
diff --git a/skyvern/core/script_generations/real_skyvern_page_ai.py b/skyvern/core/script_generations/real_skyvern_page_ai.py
index 6aa98f286..7876f6d91 100644
--- a/skyvern/core/script_generations/real_skyvern_page_ai.py
+++ b/skyvern/core/script_generations/real_skyvern_page_ai.py
@@ -217,6 +217,9 @@ class RealSkyvernPageAi(SkyvernPageAi):
try:
prompt = context.prompt
data = data or {}
+ if value and isinstance(data, dict) and "value" not in data:
+ data["value"] = value
+
if (totp_identifier or totp_url) and context and organization_id and task_id:
if totp_identifier:
totp_identifier = _render_template_with_label(totp_identifier, label=self.current_label)
@@ -340,6 +343,8 @@ class RealSkyvernPageAi(SkyvernPageAi):
try:
prompt = context.prompt
data = data or {}
+ if files and isinstance(data, dict) and "files" not in data:
+ data["files"] = files
refreshed_page = await self.scraped_page.generate_scraped_page_without_screenshots()
self.scraped_page = refreshed_page
@@ -432,6 +437,9 @@ class RealSkyvernPageAi(SkyvernPageAi):
prompt = context.prompt if context else None
# data = _get_context_data(data)
data = data or {}
+ if value and isinstance(data, dict) and "value" not in data:
+ data["value"] = value
+
refreshed_page = await self.scraped_page.generate_scraped_page_without_screenshots()
self.scraped_page = refreshed_page
element_tree = refreshed_page.build_element_tree()