Skip to content

Conversation

hackley
Copy link
Contributor

@hackley hackley commented Mar 22, 2024

Describe the changes you have made:

Checks the new message content's type before attempting to call strip(). In cases where a screenshot is being sent, content will be a list, not a string.

Reference any relevant issues (e.g. "Fixes #000"):

Pre-Submission Checklist (optional but appreciated):

  • I have included relevant documentation updates (stored in /docs)
  • I have read docs/CONTRIBUTING.md
  • I have read docs/ROADMAP.md

OS Tests (optional but appreciated):

  • Tested on Windows
  • Tested on MacOS
  • Tested on Linux

@KillianLucas KillianLucas merged commit dc29184 into openinterpreter:main Mar 24, 2024
@KillianLucas
Copy link
Collaborator

Brilliant @hackley. This was a tricky one, great fix. Merged.

@gaduffl
Copy link

gaduffl commented Mar 29, 2024

Hi there!
Seems the issue still persists on windows:

System

    Python Version: 3.11.8
    Pip Version: 23.3.1
    Open-interpreter Version: cmd: Open Interpreter 0.2.4 New Computer Update, pkg: 0.2.4
    OS Version and Architecture: Windows-10-10.0.19045-SP0
    CPU Info: Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
    RAM Info: 15.87 GB, used: 13.12, free: 2.75


    # Interpreter Info

    Vision: True
    Model: gpt-4-vision-preview
    Function calling: False
    Context window: 110000
    Max tokens: 4096

    Auto run: True
    API base: None
    Offline: False

    Curl output: Not local

Startup:

(OpenInterpreter) D:\Code\OpenInterpreter>interpreter --os
▌ OS Control enabled

User Request:

Open the rabbit.tech website

Response:

To open the rabbit.tech website, I will first use a hotkey command to open a new tab in the user's browser and then navigate to the website.

Let's do this step by step:

1 Use a hotkey to open a new browser tab (usually Command+T on Mac or Control+T on Windows).
2 Write the URL of rabbit.tech into the address bar.
3 Press Enter to navigate to the website.

Let's start by opening a new browser tab. Since the active app mentioned is "Anaconda Prompt," I'll need to switch to a browser first. I will
use the Spotlight search to open a browser. Then I will proceed with the steps mentioned above.

First, I will use a hotkey to open Spotlight, which will allow me to open a web browser. Once the browser is open, I'll navigate to the
rabbit.tech website. Let's start by opening the browser.

import time

Using Spotlight to open a browser (Safari in this case)
computer.keyboard.hotkey("space", "command")
time.sleep(1)
computer.keyboard.write("Safari")
time.sleep(1)
computer.keyboard.press("enter")
time.sleep(2)
computer.display.view()

[IPKernelApp] WARNING | Parent appears to have exited, shutting down.
[IPKernelApp] WARNING | Parent appears to have exited, shutting down.

    Python Version: 3.11.8
    Pip Version: 23.3.1...

Issue 1:

--> Open-Interpreter thinks it is running on a Mac?

Issue 2:

Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "D:\Code\miniconda3\envs\OpenInterpreter\Scripts\interpreter.exe_main
.py", line 7, in
File "D:\Code\miniconda3\envs\OpenInterpreter\Lib\site-packages\interpreter\terminal_interface\start_terminal_interface.py", line 437, in main
start_terminal_interface(interpreter)
File "D:\Code\miniconda3\envs\OpenInterpreter\Lib\site-packages\interpreter\terminal_interface\start_terminal_interface.py", line 415, in
start_terminal_interface
interpreter.chat()
File "D:\Code\miniconda3\envs\OpenInterpreter\Lib\site-packages\interpreter\core\core.py", line 167, in chat
for _ in self._streaming_chat(message=message, display=display):
File "D:\Code\miniconda3\envs\OpenInterpreter\Lib\site-packages\interpreter\core\core.py", line 196, in _streaming_chat
yield from terminal_interface(self, message)
File "D:\Code\miniconda3\envs\OpenInterpreter\Lib\site-packages\interpreter\terminal_interface\terminal_interface.py", line 136, in
terminal_interface
for chunk in interpreter.chat(message, display=False, stream=True):
File "D:\Code\miniconda3\envs\OpenInterpreter\Lib\site-packages\interpreter\core\core.py", line 235, in _streaming_chat
yield from self._respond_and_store()
File "D:\Code\miniconda3\envs\OpenInterpreter\Lib\site-packages\interpreter\core\core.py", line 281, in _respond_and_store
for chunk in respond(self):
File "D:\Code\miniconda3\envs\OpenInterpreter\Lib\site-packages\interpreter\core\respond.py", line 69, in respond
for chunk in interpreter.llm.run(messages_for_llm):
File "D:\Code\miniconda3\envs\OpenInterpreter\Lib\site-packages\interpreter\core\llm\llm.py", line 97, in run
messages = convert_to_openai_messages(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Code\miniconda3\envs\OpenInterpreter\Lib\site-packages\interpreter\core\llm\utils\convert_to_openai_messages.py", line 173, in
convert_to_openai_messages
new_message["content"] = new_message["content"].strip()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'strip'
[IPKernelApp] WARNING | Parent appears to have exited, shutting down.
[IPKernelApp] WARNING | Parent appears to have exited, shutting down.

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.

Program crashes when attempting computer.display.view() in os mode
4 participants