From c732e7d6f4cf3dd62d37db4bef436217797e57f5 Mon Sep 17 00:00:00 2001 From: nsde Date: Fri, 30 Dec 2022 23:17:42 +0100 Subject: [PATCH] last push from my laptop --- README.md | 14 ++++++++++++++ sandbox/{discord.py => .gitkeep} | 0 test.py | 19 ------------------- violet/model.txt | 21 ++++++++++++++++++++- 4 files changed, 34 insertions(+), 20 deletions(-) rename sandbox/{discord.py => .gitkeep} (100%) delete mode 100644 test.py diff --git a/README.md b/README.md index fa00089..54f959b 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ - Errors are explained ### Planned +- Start sandbox in another thread, detect print() stuff - API access (save your API tokens for various services in a `.env` file, and the bot will be able to find out e.g. the weather.) - Web UI planned (the sandbox has a way higher priority, though! No web UI is going to be worked on before there is no proper sandbox.) @@ -24,6 +25,19 @@ Additionally, never ever, give others access to the sandbox features! Malicious ✅ MacOS (probably - testers needed!) +*** + +✅ Python 3.8.10+ + +## Setup +1. Create a `.env` in *this* directory with the following content: +``` +OPENAI_API_KEY=sk-ywvx6zhMxWDeQTL69LQMKoBz4Gr26QCAhF6xom9bWUHTuujF +``` +2. Replace the value of `OPENAI_API_KEY` with your actual OpenAI API key. The API key above is just an example and doesn't work. Don't give anyone access to anything stored in your `.env`. + +3. Then - assuming you already have *Python* and *pip* installed, run `pip install -r requirements.txt` + ## Troubleshooting ### `AttributeError: Could not find PyAudio; check installation` ``` diff --git a/sandbox/discord.py b/sandbox/.gitkeep similarity index 100% rename from sandbox/discord.py rename to sandbox/.gitkeep diff --git a/test.py b/test.py deleted file mode 100644 index 6977550..0000000 --- a/test.py +++ /dev/null @@ -1,19 +0,0 @@ -# TODO Test this on Windows - -import platform -import subprocess - -# Check the operating system -os_name = platform.system() - -# Set the Discord binary path based on the operating system -if os_name == 'Windows': - discord_path = 'C:\Program Files (x86)\Discord\Discord.exe' -elif os_name == 'Darwin': # macOS - discord_path = '/Applications/Discord.app/Contents/MacOS/Discord' -else: - # Assume Linux - discord_path = '/usr/bin/discord' - -# Open Discord using the default binary path -subprocess.run([discord_path]) diff --git a/violet/model.txt b/violet/model.txt index 4b69964..38a4d97 100644 --- a/violet/model.txt +++ b/violet/model.txt @@ -41,4 +41,23 @@ print(f"{3**4+6*5}") Human: Tell me a short story. AI: One day, a kind man named John helped a traveler in need. In return, the traveler gave John a magical stone that brought him good luck and happiness. John used its magic to help others, and the villagers learned to be more compassionate. The end. Human: Start Discord. -AI: \ No newline at end of file +AI: ``` +import os +import platform +import subprocess + +# Check the operating system +os_name = platform.system() + +# Set the Discord binary path based on the operating system +if os_name == 'Windows': + discord_path = os.getenv('LOCALAPPDATA') + '\\Discord\\Update.exe' +elif os_name == 'Darwin': # macOS + discord_path = '/Applications/Discord.app/Contents/MacOS/Discord' +else: # Assume Linux + discord_path = '/usr/bin/discord' + +# Open Discord using the default binary path +subprocess.run([discord_path]) +print("Alright. Opening Discord...") +``` \ No newline at end of file