From 158529a2bd06d78aedf4eb283fece861bcd76787 Mon Sep 17 00:00:00 2001 From: Showdown76py Date: Mon, 19 May 2025 13:41:25 +0200 Subject: [PATCH] fix: Parse tool call arguments as JSON for improved handling in process method --- ai/processor.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ai/processor.py b/ai/processor.py index c454063..0412144 100644 --- a/ai/processor.py +++ b/ai/processor.py @@ -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) ) ) ))