Skip to content

Commit 490d5a2

Browse files
committed
fix: correct typos in error messages and guard empty coordinate extraction
1 parent 30ff667 commit 490d5a2

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/askui/models/anthropic/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44
def extract_click_coordinates(text: str) -> tuple[int, int]:
55
pattern = r"<click>(\d+),\s*(\d+)"
66
matches = re.findall(pattern, text)
7+
if not matches:
8+
msg = f"No click coordinates found in text: {text}"
9+
raise ValueError(msg)
710
x, y = matches[-1]
811
return int(x), int(y)

src/askui/tools/android/ppadb_agent_os.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def _get_selected_device(self) -> AndroidDevice:
436436
devices: list[AndroidDevice] = self._get_connected_devices()
437437

438438
if not self._device:
439-
msg = "No device is selected, did you call on of the set_device methods?"
439+
msg = "No device is selected, did you call one of the set_device methods?"
440440
raise AndroidAgentOsError(msg)
441441

442442
for device in devices:
@@ -447,7 +447,7 @@ def _get_selected_device(self) -> AndroidDevice:
447447

448448
def _check_if_display_is_selected(self) -> None:
449449
if self._selected_display is None:
450-
msg = "No display is selected, did you call on of the set_display methods?"
450+
msg = "No display is selected, did you call one of the set_display methods?"
451451
raise AndroidAgentOsError(msg)
452452

453453
def _get_connected_devices(self) -> list[AndroidDevice]:

0 commit comments

Comments
 (0)