Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(computer): add macOS support for computer tool #324

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ErikBjare
Copy link
Owner

  • Add native macOS implementations using osascript and screencapture
  • Add platform detection and conditional execution
  • Improve security with input sanitization
  • Add comprehensive error handling
  • Update documentation with macOS-specific details

- Add native macOS implementations using osascript and screencapture
- Add platform detection and conditional execution
- Improve security with input sanitization
- Add comprehensive error handling
- Update documentation with macOS-specific details
@codecov-commenter
Copy link

codecov-commenter commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 9.41176% with 77 lines in your changes missing coverage. Please review.

Project coverage is 71.64%. Comparing base (202869e) to head (a7fa656).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
gptme/tools/computer.py 9.41% 77 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #324      +/-   ##
==========================================
- Coverage   72.79%   71.64%   -1.16%     
==========================================
  Files          67       67              
  Lines        4933     5000      +67     
==========================================
- Hits         3591     3582       -9     
- Misses       1342     1418      +76     
Flag Coverage Δ
anthropic/claude-3-haiku-20240307 69.80% <9.41%> (-1.01%) ⬇️
openai/gpt-4o-mini 68.64% <9.41%> (-0.78%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +476 to +505
Assistant: I'll capture the current screen using the native screenshot tool.
{ToolUse("ipython", [], 'computer("screenshot")').to_output(tool_format)}
System: Viewing image...

User: Type "Hello, World!" into the active window
Assistant: I'll type the text with realistic delays.
Assistant: I'll type the text with realistic delays using the native input method.
{ToolUse("ipython", [], 'computer("type", text="Hello, World!")').to_output(tool_format)}
System: Typed text: Hello, World!

User: Move the mouse to coordinates (100, 200) and click
Assistant: I'll move the mouse and perform a left click.
Assistant: I'll move the mouse and perform a left click using native mouse control.
{ToolUse("ipython", [], 'computer("mouse_move", coordinate=(100, 200))').to_output(tool_format)}
System: Moved mouse to 100,200
{ToolUse("ipython", [], 'computer("left_click")').to_output(tool_format)}
System: Performed left_click

User: Press Ctrl+C
Assistant: I'll send the Control+C key sequence.
Assistant: I'll send the Control+C key sequence using platform-appropriate key names.
{ToolUse("ipython", [], 'computer("key", text="Control_L+c")').to_output(tool_format)}
System: Sent key sequence: Control_L+c

User: Get the current mouse position
Assistant: I'll get the cursor position using the native method.
{ToolUse("ipython", [], 'computer("cursor_position")').to_output(tool_format)}
System: Cursor position: X=512,Y=384

User: Double-click at current position
Assistant: I'll perform a double-click using the native method.
{ToolUse("ipython", [], 'computer("double_click")').to_output(tool_format)}
System: Performed double_click
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silly repetitive "using the native method"

@ErikBjare
Copy link
Owner Author

@Miyou Wanna give this a spin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants