fix: Parse tool call arguments as JSON for improved handling in process method
This commit is contained in:
		@@ -58,6 +58,7 @@ class AIProcessor:
 | 
			
		||||
            tool_calls = getattr(response.choices[0].message, "tool_calls", None)
 | 
			
		||||
            if tool_calls:
 | 
			
		||||
                for tc in tool_calls:
 | 
			
		||||
                    ags = json.loads(tc.function.arguments)
 | 
			
		||||
                    logger.debug(
 | 
			
		||||
                        "Processing tool call: %s with arguments: %s",
 | 
			
		||||
                        tc.function.name,
 | 
			
		||||
@@ -66,15 +67,15 @@ class AIProcessor:
 | 
			
		||||
                    if tc.function.name == "confirm":
 | 
			
		||||
                        reexec = False
 | 
			
		||||
                        try:
 | 
			
		||||
                            nextsteps = tc.function.arguments.get("goal", "")
 | 
			
		||||
                            nextsteps = ags.get("goal", "")
 | 
			
		||||
                        except:
 | 
			
		||||
                            nextsteps = str(tc.function.arguments)
 | 
			
		||||
                            print('ERROR NEXT STEPS IS STR, ', nextsteps)
 | 
			
		||||
                    if tc.function.name == "click_button":
 | 
			
		||||
                        # extract click position for screenshot crosshair
 | 
			
		||||
                        click_positions.extend(tuple( # button_type, x, y
 | 
			
		||||
                            map(int,(tc.function.arguments.get("x", 0),
 | 
			
		||||
                                    tc.function.arguments.get("y", 0)
 | 
			
		||||
                            map(int,(ags.get("x", 0),
 | 
			
		||||
                                    ags.get("y", 0)
 | 
			
		||||
                                )
 | 
			
		||||
                            )
 | 
			
		||||
                        ))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user