Better handling of failed to summarize failure reason (#1218)
This commit is contained in:
@@ -1700,11 +1700,11 @@ class ForgeAgent:
|
|||||||
step: Step,
|
step: Step,
|
||||||
page: Page | None,
|
page: Page | None,
|
||||||
) -> str:
|
) -> str:
|
||||||
|
steps_results = []
|
||||||
try:
|
try:
|
||||||
steps = await app.DATABASE.get_task_steps(
|
steps = await app.DATABASE.get_task_steps(
|
||||||
task_id=task.task_id, organization_id=organization.organization_id
|
task_id=task.task_id, organization_id=organization.organization_id
|
||||||
)
|
)
|
||||||
steps_results = []
|
|
||||||
for step_cnt, step in enumerate(steps):
|
for step_cnt, step in enumerate(steps):
|
||||||
if step.output is None:
|
if step.output is None:
|
||||||
continue
|
continue
|
||||||
@@ -1741,9 +1741,11 @@ class ForgeAgent:
|
|||||||
)
|
)
|
||||||
json_response = await app.LLM_API_HANDLER(prompt=prompt, screenshots=screenshots, step=step)
|
json_response = await app.LLM_API_HANDLER(prompt=prompt, screenshots=screenshots, step=step)
|
||||||
return json_response.get("reasoning", "")
|
return json_response.get("reasoning", "")
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception("Failed to summary the failure reason", task=task.task_id)
|
LOG.warning("Failed to summary the failure reason", task_id=task.task_id, step_id=step.step_id)
|
||||||
|
if steps_results:
|
||||||
|
last_step_result = steps_results[-1]
|
||||||
|
return f"Step {last_step_result['order']}: {last_step_result['actions_result']}"
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
async def handle_completed_step(
|
async def handle_completed_step(
|
||||||
|
|||||||
Reference in New Issue
Block a user