From 1925a77d85222c17032888f1309ad3eb9a4ae8c4 Mon Sep 17 00:00:00 2001 From: Showdown76py Date: Mon, 19 May 2025 09:34:21 +0200 Subject: [PATCH] Add screenshot re-execution logic in AIProcessor; append outputs from tool calls --- ai/processor.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ai/processor.py b/ai/processor.py index d80d8a1..5fd105e 100644 --- a/ai/processor.py +++ b/ai/processor.py @@ -62,13 +62,21 @@ class AIProcessor: processor=self, ) outputs.append(r) if r else None + if reexec: + img = ai.compute.screenshot_to_base64( + ai.compute.take_screenshot() + ) + + outputs.append( + *self.process(nextsteps, img) + ) return [ { "name": tc.function.name, "arguments": json.loads(tc.function.arguments), } for tc in tool_calls - ] + ] + outputs # type: ignore # otherwise return final assistant content print(f"Response: {json.dumps(response.to_dict(), indent=4)}") # debug