only include last action result in history (#3741)

This commit is contained in:
LawyZheng
2025-10-16 23:50:41 +08:00
committed by GitHub
parent 5531367566
commit edcd0b0e57

View File

@@ -36,17 +36,17 @@ async def get_action_history(
exclude_none=True, exclude_none=True,
include={"action_type", "element_id", "status", "reasoning", "option", "download"}, include={"action_type", "element_id", "status", "reasoning", "option", "download"},
), ),
"results": [ # use the last result of the action, because some actions(like chain_click)
result.model_dump( # might have multiple results. Only the last one can represent the real result,
exclude_none=True, # the previous results will be all failed
include={ "result": results[-1].model_dump(
"success", exclude_none=True,
"exception_type", include={
"exception_message", "success",
}, "exception_type",
) "exception_message",
for result in results },
], ),
} }
for action, results in actions_and_results for action, results in actions_and_results
if len(results) > 0 if len(results) > 0