integrate parameters to support legacy tasks with parameters (#3567)
This commit is contained in:
@@ -1350,6 +1350,18 @@ def __build_base_task_statement(
|
||||
) -> list[cst.Arg]:
|
||||
block_type = block.get("block_type")
|
||||
prompt = block.get("prompt") if block_type == "task_v2" else block.get("navigation_goal")
|
||||
# add parameters to prompt
|
||||
parameters = block.get("parameters", [])
|
||||
navigation_payload = {}
|
||||
# make all parameters as jinja2 template parameters in the generated code
|
||||
for parameter in parameters:
|
||||
parameter_key = parameter["key"]
|
||||
navigation_payload[parameter_key] = "{{" + parameter_key + "}}"
|
||||
|
||||
if navigation_payload:
|
||||
prompt = prompt or ""
|
||||
prompt = f"{prompt}\n{navigation_payload}"
|
||||
|
||||
args = [
|
||||
cst.Arg(
|
||||
keyword=cst.Name("prompt"),
|
||||
|
||||
@@ -509,7 +509,7 @@ class SkyvernPage:
|
||||
if ai_infer and intention:
|
||||
try:
|
||||
prompt = context.prompt if context else None
|
||||
data = _get_context_data(data)
|
||||
data = data or {}
|
||||
if (totp_identifier or totp_url) and context and organization_id and task_id:
|
||||
verification_code = await poll_verification_code(
|
||||
organization_id=organization_id,
|
||||
@@ -535,7 +535,6 @@ class SkyvernPage:
|
||||
script_generation_input_text_prompt = prompt_engine.load_prompt(
|
||||
template="script-generation-input-text-generatiion",
|
||||
intention=intention,
|
||||
data=data,
|
||||
goal=prompt,
|
||||
)
|
||||
json_response = await app.SINGLE_INPUT_AGENT_LLM_API_HANDLER(
|
||||
@@ -620,7 +619,8 @@ class SkyvernPage:
|
||||
if ai_infer and intention and task and step:
|
||||
try:
|
||||
prompt = context.prompt if context else None
|
||||
data = _get_context_data(data)
|
||||
# data = _get_context_data(data)
|
||||
data = data or {}
|
||||
refreshed_page = await self.scraped_page.generate_scraped_page_without_screenshots()
|
||||
self.scraped_page = refreshed_page
|
||||
element_tree = refreshed_page.build_element_tree()
|
||||
|
||||
Reference in New Issue
Block a user