From f2afdcb21460bcb2621d915b727b9d1f219b6d8b Mon Sep 17 00:00:00 2001 From: Dillon DuPont Date: Fri, 18 Apr 2025 12:15:48 -0400 Subject: [PATCH] fixed scrolling, adjusted oai scroll sensitivity --- libs/agent/agent/providers/openai/tools/computer.py | 4 ++-- libs/computer/computer/interface/macos.py | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/libs/agent/agent/providers/openai/tools/computer.py b/libs/agent/agent/providers/openai/tools/computer.py index 9f4e606d..ae4fdce8 100644 --- a/libs/agent/agent/providers/openai/tools/computer.py +++ b/libs/agent/agent/providers/openai/tools/computer.py @@ -162,8 +162,8 @@ class ComputerTool(BaseComputerTool, BaseOpenAITool): y = kwargs.get("y") if x is None or y is None: raise ToolError("x and y coordinates are required for scroll action") - scroll_x = kwargs.get("scroll_x", 0) - scroll_y = kwargs.get("scroll_y", 0) + scroll_x = kwargs.get("scroll_x", 0) // 20 + scroll_y = kwargs.get("scroll_y", 0) // 20 return await self.handle_scroll(x, y, scroll_x, scroll_y) elif type == "screenshot": return await self.screenshot() diff --git a/libs/computer/computer/interface/macos.py b/libs/computer/computer/interface/macos.py index bab8b66b..a3b99f7d 100644 --- a/libs/computer/computer/interface/macos.py +++ b/libs/computer/computer/interface/macos.py @@ -414,12 +414,10 @@ class MacOSComputerInterface(BaseComputerInterface): # Scrolling Actions async def scroll_down(self, clicks: int = 1) -> None: - for _ in range(clicks): - await self.hotkey(Key.PAGE_DOWN) - + await self._send_command("scroll_down", {"clicks": clicks}) + async def scroll_up(self, clicks: int = 1) -> None: - for _ in range(clicks): - await self.hotkey(Key.PAGE_UP) + await self._send_command("scroll_up", {"clicks": clicks}) # Screen Actions async def screenshot(