Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix for https://github.com/trycua/cua/issues/165

Dillon DuPont8137e0777527
diff --git a/libs/computer/computer/interface/macos.py b/libs/computer/computer/interface/macos.py
index c267435230..dcac634208 100644
--- a/libs/computer/computer/interface/macos.py
+++ b/libs/computer/computer/interface/macos.py
@@ -335,7 +335,15 @@ class MacOSComputerInterface(BaseComputerInterface):
# Keyboard Actions
async def type_text(self, text: str) -> None:
- await self._send_command("type_text", {"text": text})
+ # Temporary fix for https://github.com/trycua/cua/issues/165
+ # Check if text contains Unicode characters
+ if any(ord(char) > 127 for char in text):
+ # For Unicode text, use clipboard and paste
+ await self.set_clipboard(text)
+ await self.hotkey(Key.COMMAND, 'v')
+ else:
+ # For ASCII text, use the regular typing method
+ await self._send_command("type_text", {"text": text})
async def press(self, key: "KeyType") -> None:
"""Press a single key.