CUA feature - extraction data combined assisstant's message (#2157)

This commit is contained in:
Shuchang Zheng
2025-04-14 22:54:41 -07:00
committed by GitHub
parent 18f24745d0
commit cac9e6a61a
4 changed files with 17 additions and 19 deletions

View File

@@ -1165,7 +1165,9 @@ class ForgeAgent:
): ):
working_page = await browser_state.must_get_working_page() working_page = await browser_state.must_get_working_page()
# refresh task in case the extracted information is updated previously # refresh task in case the extracted information is updated previously
task = await app.DATABASE.get_task(task.task_id, task.organization_id) refreshed_task = await app.DATABASE.get_task(task.task_id, task.organization_id)
assert refreshed_task is not None
task = refreshed_task
extract_action = await self.create_extract_action(task, step, scraped_page) extract_action = await self.create_extract_action(task, step, scraped_page)
extract_results = await ActionHandler.handle_action( extract_results = await ActionHandler.handle_action(
scraped_page, task, step, working_page, extract_action scraped_page, task, step, working_page, extract_action

View File

@@ -14,7 +14,7 @@ If you are trying to extract the href links which are using the jinja style like
User Data Extraction Goal: {{ data_extraction_goal }} User Data Extraction Goal: {{ data_extraction_goal }}
{% if previous_extracted_information %} {% if previous_extracted_information %}
Previous contexts or thoughts: {{ previous_extracted_information }} Previous contexts or thoughts: ```{{ previous_extracted_information }}```
{% endif %} {% endif %}
{% if error_code_mapping_str %} {% if error_code_mapping_str %}

View File

@@ -232,9 +232,6 @@ class Task(TaskBase):
if status.cant_have_extracted_info() and extracted_information is not None: if status.cant_have_extracted_info() and extracted_information is not None:
raise ValueError(f"status_cant_have_extracted_information({self.task_id})") raise ValueError(f"status_cant_have_extracted_information({self.task_id})")
if self.extracted_information is not None and extracted_information is not None:
raise ValueError(f"cant_override_extracted_information({self.task_id})")
if self.failure_reason is not None and failure_reason is not None: if self.failure_reason is not None and failure_reason is not None:
raise ValueError(f"cant_override_failure_reason({self.task_id})") raise ValueError(f"cant_override_failure_reason({self.task_id})")

View File

@@ -338,20 +338,19 @@ async def parse_cua_actions(
intention=reasoning, intention=reasoning,
) )
if skyvern_action_type == "complete": if skyvern_action_type == "complete":
if not task.data_extraction_goal and useful_information: LOG.info(
LOG.info( "Updating task with useful information",
"Updating task with useful information", task_id=task.task_id,
task_id=task.task_id, organization_id=task.organization_id,
organization_id=task.organization_id, useful_information=useful_information,
useful_information=useful_information, assistant_message=assistant_message,
assistant_message=assistant_message, reasoning=reasoning,
reasoning=reasoning, )
) await app.DATABASE.update_task(
await app.DATABASE.update_task( task.task_id,
task.task_id, organization_id=task.organization_id,
organization_id=task.organization_id, extracted_information=assistant_message,
extracted_information=assistant_message, )
)
action = CompleteAction( action = CompleteAction(
reasoning=reasoning, reasoning=reasoning,
intention=reasoning, intention=reasoning,