OpenInterpreter / open-interpreter

A natural language interface for computers
http://openinterpreter.com/
GNU Affero General Public License v3.0
52.16k stars 4.61k forks source link

--os --vision ("Name Computer is Not defined) #1047

Open ngoiyaeric opened 6 months ago

ngoiyaeric commented 6 months ago

Describe the bug

Hi, I'm trying to get oi to control my chrome browser. I want to utilize vision and scripts to click on buttons and achieve a task. There seems to be a recurring error. Previously I thought it was a request module issue into the api.openinterpreter.com endpoint. This does not seem to be the case.

Reproduce

interpreter --os --vision api key go to webiste x and do something

Expected behavior

button click after screenshot and vision processing

Screenshots

Screen Shot 2024-03-01 at 7 47 41 AM

Open Interpreter version

Open Interpreter 0.2.0 New Computer

Python version

Python 3.12.1

Operating System name and version

12.7.3

Additional context

AppleScripts seemed to replace computer module functionality up until the cursor is required.

ngoiyaeric commented 6 months ago

Screen Shot 2024-03-01 at 7 59 21 AM

alexeydemidovkz commented 5 months ago

Having same problem, looks like it tries to correct itself but repeat everything again:

find a youtube video in safari called become a shell wizard

  To begin with, I'll switch to the Safari application to ensure we are in the right context for the search. Then, I'll initiate a search on YouTube for
  the video titled "become a shell wizard". Let's execute this plan step by step.

  I will start by opening Spotlight with a hotkey and typing "Safari" to switch to the Safari application. Then I'll use the search function to look for
  the YouTube video.

Expecting value: line 1 column 1 (char 0)
Continuing.

  import time

  # Use hotkey to open Spotlight search
  computer.keyboard.hotkey("space", "command")

  # Wait for Spotlight to open
  time.sleep(2)

  # Type 'Safari' to open Safari
  computer.keyboard.write("Safari")

  # Wait a moment for Safari to become the active application
  time.sleep(2)

  # After this, we need to verify if Safari is in fact the active application.
  # The following command will allow us to see what’s happening on the screen.
  computer.display.view()

  ---------------------------------------------------------------------------
  NameError                                 Traceback (most recent call last)
  Cell In[8], line 8
        6 pass
        7 print('##active_line4##')
  ----> 8 computer.keyboard.hotkey('space', 'command')
        9 print('##active_line5##')
       10 pass

  NameError: name 'computer' is not defined

  It seems I attempted to use a command that is not currently supported. Let me correct this and proceed with the task using the right command to switch
  to Safari. I will open Safari with the correct hotkey command. Then, I'll check the screen again to ensure Safari is active.

  Great, let's proceed with switching to Safari.

Expecting value: line 1 column 1 (char 0)
Continuing.

  import time

  # Use hotkey to open Spotlight search
  computer.keyboard.hotkey("space", "command")

  # Wait for Spotlight to open
  time.sleep(1)

  # Type 'Safari' to open Safari
  computer.keyboard.write("Safari\n")

  # Wait for Safari to become the active application
  time.sleep(2)

  # Now, let's verify if Safari is the active application by viewing the screen.
  computer.display.view()

  ---------------------------------------------------------------------------
  NameError                                 Traceback (most recent call last)
  Cell In[17], line 8
        6 pass
        7 print('##active_line4##')
  ----> 8 computer.keyboard.hotkey('space', 'command')
        9 print('##active_line5##')
       10 pass

  NameError: name 'computer' is not defined

  It seems there was an error with the code execution, as thecomputer module isn't recognized. Considering that thecomputer module should normally work
  in this context, it appears there may be an issue with the execution environment.

  Since I cannot execute the code directly, I'll diverge to guide you through the steps you would need to take to perform the search manually.

  Open Safari by clicking on its icon in the dock or by using Spotlight search (Command + Space, then type "Safari" and press Enter). Once Safari is
  open, click on the address bar at the top of the window and type "youtube.com" and press Enter. In the search bar on YouTube, type "become a shell
  wizard" and press Enter to search for the video.

  Understood. Let's attempt to open Safari again using the correct code approach. This time I'll ensure that the code execution environment is correct
  and then proceed to search YouTube for the video titled "become a shell wizard" within Safari.

  I will start the process now.

Expecting value: line 1 column 1 (char 0)
Continuing.

  import time

  # Use hotkey to open Spotlight search
  computer.keyboard.hotkey("space", "command")

  # Wait for Spotlight to open
  time.sleep(1)

  # Type 'Safari' to open Safari
  computer.keyboard.write("Safari\n")

  # Allow some time for the application to switch.
  time.sleep(2)

  # Check what is on the screen to make sure Safari is active
  computer.display.view()

  ---------------------------------------------------------------------------
  NameError                                 Traceback (most recent call last)
  Cell In[26], line 8
        6 pass
        7 print('##active_line4##')
  ----> 8 computer.keyboard.hotkey('space', 'command')
        9 print('##active_line5##')
       10 pass

  NameError: name 'computer' is not defined

Maybe worth noting (no - i have tried to ask it for a different key combo with same result ----> 8 computer.keyboard.hotkey('command', 'shift', 'f')) that the hot key command - space is not defined as spotlight search on my computer (multi language keyboard) but it is not clear from the error.

aj47 commented 2 months ago

i have this issue running --os i was able to overcome it using os.py profile with interpreter --profile os.py

make sure you have the os.py profile in your profiles directory (interpreter --profiles)

you can find the file here: https://github.com/OpenInterpreter/open-interpreter/blob/main/interpreter/terminal_interface/profiles/defaults/os.py

1225 #1276 #1047