diff --git a/.gitignore b/.gitignore index 4966fdd69b..b55bd94f30 100644 --- a/.gitignore +++ b/.gitignore @@ -240,4 +240,5 @@ litellm_uuid.txt .aider* file.txt numbers.txt -poetry.lock \ No newline at end of file +poetry.lock +uv.lock diff --git a/.python-version b/.python-version new file mode 100644 index 0000000000..e4fba21835 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.12 diff --git a/README.md b/README.md index 92277d82a4..c522126f0e 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,14 @@ A modern command line assistant. [Documentation](https://docs.openinterpreter.com/) | [Discord](https://discord.gg/Hvz9Axh84z) +NOTICE! +THIS IS A FORK MAINTAINED BY ME, Anton. + +Contibuting: +install UV +git clone +cd open-interpreter +uv sync ## Install diff --git a/interpreter/cli.py b/interpreter/cli.py index 5b81e4622a..628357b435 100644 --- a/interpreter/cli.py +++ b/interpreter/cli.py @@ -186,24 +186,13 @@ async def async_load_interpreter(args): async def async_main(args): global global_interpreter - if args["serve"]: - global_interpreter = await async_load_interpreter(args) - print("Starting server...") - global_interpreter.server() - return - - if ( - args["input"] is None - and sys.stdin.isatty() - and sys.argv[0].endswith("interpreter") - ): + # Display welcome message if appropriate + if (args["input"] is None and sys.stdin.isatty() and sys.argv[0].endswith("interpreter")): from .misc.welcome import welcome_message - welcome_message() - if args["input"] is None and ( - sys.stdin.isatty() and args.get("no_interactive") is not True - ): + # Handle interactive terminal mode with concurrent loading + if args["input"] is None and (sys.stdin.isatty() and args.get("no_interactive") is not True): # Load the interpreter in a separate thread def load_interpreter_thread(args): loop = asyncio.new_event_loop() @@ -213,17 +202,30 @@ def load_interpreter_thread(args): thread = threading.Thread(target=load_interpreter_thread, args=(args,)) thread.start() - # Get user input + # Get user input while the interpreter is loading message = await async_get_input() # Wait for the thread to finish thread.join() + + # Check if message is a command before processing it + if message.startswith("/"): + print() + parts = message.split(maxsplit=2) + cmd = parts[0].lower() + global_interpreter._handle_command(cmd, parts) + if global_interpreter.interactive: + await global_interpreter.async_chat() + return else: + # Load interpreter synchronously spinner = SimpleSpinner() spinner.start() global_interpreter = await async_load_interpreter(args) message = args["input"] if args["input"] is not None else sys.stdin.read() spinner.stop() + + # Process the message print() global_interpreter.messages = [{"role": "user", "content": message}] try: diff --git a/interpreter/interpreter.py b/interpreter/interpreter.py index 29c93e7abc..695b2e80a9 100644 --- a/interpreter/interpreter.py +++ b/interpreter/interpreter.py @@ -1073,6 +1073,21 @@ def server(self): # Create and start server server = Server(self) try: + host = server.host + port = server.port + + print("\n" + "=" * 60) + print(f"Open Interpreter API Server") + print("=" * 60) + print("\nTo use with an OpenAI-compatible client, configure:") + print(f" - API Base: http://{host}:{port}") + print(f" - API Path: /chat/completions") + print(f" - API Key: (any value, authentication not required)") + print(f" - Model name: (any value, ignored)") + print("\nNOTE: The server will use the model configured in --model") + print(f" Currently using: {self.model}") + print("=" * 60 + "\n") + server.run() except KeyboardInterrupt: print("\nShutting down server...") diff --git a/interpreter/misc/welcome.py b/interpreter/misc/welcome.py index c216e51bb1..10e6007e3a 100644 --- a/interpreter/misc/welcome.py +++ b/interpreter/misc/welcome.py @@ -301,6 +301,6 @@ def welcome_message(): or: interpreter [options] Documentation: docs.openinterpreter.com -Run 'interpreter --help' for all options +Run 'interpreter --help' for all options or type /help """ ) diff --git a/pyproject.toml b/pyproject.toml index ad2765266d..80a4636b87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,48 +1,47 @@ -[tool.poetry] +[project] name = "open-interpreter" -packages = [ - {include = "interpreter"}, - {include = "scripts"}, -] -version = "1.0.0" # Use "-rc1", "-rc2", etc. for pre-release versions +version = "1.0.0" # Use "-rc1", "-rc2", etc. for pre-release versions description = "A natural language interface for computers" -authors = ["Killian Lucas "] +authors = [ + {name = "Killian Lucas", email = "killian@openinterpreter.com"}, +] readme = "README.md" +requires-python = ">=3.9,<3.13" +dependencies = [ + "litellm>=1.52.3", + "anthropic>=0.39.0", + "pygments>=2.18.0", + "pyautogui>=0.9.54", + "fastapi>=0.115.4", + "prompt-toolkit>=3.0.48", + "pyte>=0.8.2", + "screeninfo>=0.8.1", + "readchar>=4.2.1", + "pillow>=10.3.0", + "uvicorn>=0.32.0", + "pynput>=1.7.7", + "httpx==0.27.2", + "colorama>=0.4.6", +] -[tool.poetry.dependencies] - -# Required dependencies -python = ">=3.9,<4" -litellm = "^1.52.3" -anthropic = "^0.39.0" -pygments = "^2.18.0" -pyautogui = "^0.9.54" -fastapi = "^0.115.4" -prompt-toolkit = "^3.0.48" -pyte = "^0.8.2" -screeninfo = "^0.8.1" -readchar = "^4.2.1" -pillow = ">=10.3.0" -uvicorn = "^0.32.0" -pynput = "^1.7.7" -httpx = "0.27.2" -colorama = "^0.4.6" - -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" - -[tool.poetry.scripts] +[project.scripts] i = "interpreter.cli:main" interpreter = "interpreter.cli:main" interpreter-shell = "scripts.shell:main" interpreter-uninstall-shell = "scripts.uninstall_shell:main" wtf = "scripts.wtf:main" +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build.targets.wheel] +packages = ["interpreter", "scripts"] + [tool.black] -target-version = ['py311'] +target-version = ["py311"] [tool.isort] profile = "black" multi_line_output = 3 -include_trailing_comma = true +include_trailing_comma = true \ No newline at end of file