Add screenshot re-execution logic in AIProcessor; append outputs from tool calls
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user