From fc0c154d41dd06a7e8064460695851c5346e987b Mon Sep 17 00:00:00 2001 From: "system32.eth" <23362597+Raecaug@users.noreply.github.com> Date: Fri, 2 Feb 2024 22:16:13 -0500 Subject: [PATCH 1/8] Update AI-MODERATION.md Remove old & outdated references, small cleanup Signed-off-by: system32.eth <23362597+Raecaug@users.noreply.github.com> --- detailed_guides/AI-MODERATION.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/detailed_guides/AI-MODERATION.md b/detailed_guides/AI-MODERATION.md index 3768f10d..eb618dc6 100644 --- a/detailed_guides/AI-MODERATION.md +++ b/detailed_guides/AI-MODERATION.md @@ -1,5 +1,5 @@ ### Automatic AI Moderation - +*** `/mod set status:on` - Turn on automatic chat moderations. `/mod set status:off` - Turn off automatic chat moderations @@ -12,15 +12,12 @@ The bot needs Administrative permissions for this, and you need to set `MODERATIONS_ALERT_CHANNEL` to the channel ID of a desired channel in your .env file if you want to receive alerts about moderated messages. -This uses the OpenAI Moderations endpoint to check for messages, requests are only sent to the moderations endpoint at a MINIMUM request gap of 0.5 seconds, to ensure you don't get blocked and to ensure reliability. +This uses the OpenAI Moderations endpoint to check for messages; requests are only sent to the moderations endpoint at a MINIMUM request gap of 0.5 seconds, to ensure you don't get blocked and to ensure reliability. The bot uses numerical thresholds to determine whether a message is toxic or not, and I have manually tested and fine tuned these thresholds to a point that I think is good, please open an issue if you have any suggestions for the thresholds! -There are two thresholds for the bot, there are instances in which the bot will outright delete a message and an instance where the bot will send a message to the alert channel notifying admins and giving them quick options to delete and timeout the user (check out the screenshots at the beginning of the README to see this). +There are two thresholds for the bot, there are instances in which the bot will outright delete a message and an instance where the bot will send a message to the alert channel notifying admins and giving them quick options to delete and timeout the user. To set a certain role immune to moderations, add the line `CHAT_BYPASS_ROLES="Role1,Role2,etc"` to your `.env file. If you want to have the bot pre-moderate things sent to commands like /gpt ask, /gpt edit, /dalle draw, etc, you can set `PRE_MODERATE="True"` in the `.env` file. - -**The above server is NOT for support or discussions about GPT3Discord** - From 3b938ca68c8f307991fe824a3a642f0238b274cf Mon Sep 17 00:00:00 2001 From: "system32.eth" <23362597+Raecaug@users.noreply.github.com> Date: Fri, 2 Feb 2024 22:47:57 -0500 Subject: [PATCH 2/8] Update AI-SEARCH.md Clean up small errors and complete screenshots for final 2 steps of guide. Signed-off-by: system32.eth <23362597+Raecaug@users.noreply.github.com> --- detailed_guides/AI-SEARCH.md | 60 ++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/detailed_guides/AI-SEARCH.md b/detailed_guides/AI-SEARCH.md index 936edd0b..44ed3ef6 100644 --- a/detailed_guides/AI-SEARCH.md +++ b/detailed_guides/AI-SEARCH.md @@ -5,28 +5,29 @@ GOOGLE_SEARCH_API_KEY="...." GOOGLE_SEARCH_ENGINE_ID="...." ``` -You first need to create a programmable search engine and get the search engine ID: https://developers.google.com/custom-search/docs/tutorial/creatingcse +You first need to create a programmable search engine and get the search engine ID [here](https://developers.google.com/custom-search/docs/tutorial/creatingcse). -Then you can get the API key, click the "Get a key" button on this page: https://developers.google.com/custom-search/v1/introduction +Then you can get the API key, click the "Get a key" button [on this page](https://developers.google.com/custom-search/v1/introduction). You can limit the max price that is charged for a single search request by setting `MAX_SEARCH_PRICE` in your `.env` file. +Step by Step Guide: +--- -1\. Go to the [Programmable Search Engine docs](https://developers.google.com/custom-search/docs/tutorial/creatingcse) to get a Search engine ID ----------------------------------------------------------------------- +1\. Go to the [Programmable Search Engine docs](https://developers.google.com/custom-search/docs/tutorial/creatingcse) to get a Search engine ID. +--- -2\. Click on "Control Panel" under "Defining a Programmable Engine in Control Panel" ----------------------------------------- +a. Click on "Control Panel" under "Defining a Programmable Engine in Control Panel" -Click to sign in(make a Google acct if you do not have one): +b. Click to sign in(make a Google account if you do not have one): ![image](https://user-images.githubusercontent.com/23362597/233266042-98098ed5-72b2-41b3-9495-1a9f4d7e1101.png) -3\. Register yourself a new account/Login to the Control Panel +2\. Register yourself a new account/Login to the Control Panel ----------------------------------- After logging in, you will be redirected to the Control Panel to create a new search engine: @@ -34,7 +35,7 @@ After logging in, you will be redirected to the Control Panel to create a new se ![image](https://user-images.githubusercontent.com/23362597/233266323-53232468-2590-4820-b55f-08c78529d752.png) -4\. Create a new search engine +3\. Create a new search engine ------------------------------ Fill in a name, select to "Search the entire web" and hit "Create": @@ -42,13 +43,13 @@ Fill in a name, select to "Search the entire web" and hit "Create": ![image](https://user-images.githubusercontent.com/23362597/233266738-b70f004d-4324-482e-a945-9b0193b60158.png) -5\. Copy your Search engine ID to your .env file +4\. Copy your Search engine ID to your .env file -------------------------- ![image](https://user-images.githubusercontent.com/23362597/233267123-ea25a3bb-6cdb-4d46-a893-846ea4933632.png) -6\. Go to [custom-search docs](https://developers.google.com/custom-search/v1/introduction) to get a Google search API key +5\. Go to [custom-search docs](https://developers.google.com/custom-search/v1/introduction) to get a Google search API key ------------------------------------------------- Click "Get a Key": @@ -56,23 +57,48 @@ Click "Get a Key": ![image](https://user-images.githubusercontent.com/23362597/233267659-f82621f4-1f0b-46bf-8994-be443dd79932.png) -7\. Name your project and agree to the Terms of Service +6\. Name your project and agree to the Terms of Service ------------------------------------ ![image](https://user-images.githubusercontent.com/23362597/233267793-ca3c273d-ebc6-44a5-a49d-0d4c3223c992.png) -8\. Copy your Google search API key to your .env file +7\. Copy your Google search API key to your .env file ------------------------------------ ![image](https://user-images.githubusercontent.com/23362597/233268067-5a6cfaf1-bec0-48b3-8add-70b218fb4264.png) -9\. Enable Cloud Vision API for image recognition +8\. Enable Cloud Vision API for image recognition +------------------------------------ +a. Navigate to the Google Cloud API console [here](https://console.cloud.google.com/apis/api/vision.googleapis.com/). + +b. Click on 'Create Project': + +![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/f128cc80-2a53-4578-9f4e-99791d7f8ffe) + + +c. Give it a name and create it: + +![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/35050805-f2ad-4489-8d8c-dacbd961c0b1) + + +d. Now, navigate to the API Library: + +![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/0eff23c1-09c1-4e65-a08a-a56af5515727) + + +e. Search for the 'Cloud Vision API' and enable it: + +![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/ef225dbe-4385-4263-b0aa-7100bbfed0e8) + + +9\. Enable Custom Search API for Google search +------------------------------------ -https://console.cloud.google.com/apis/api/vision.googleapis.com/ +You can follow [this link](https://console.cloud.google.com/apis/api/customsearch.googleapis.com/) to quickly jump to the page to enable the custom search API. You may need to first selet the project you created before: +![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/875039dc-88b8-47a2-ad6e-4d39be26781d) -10\. Enable Custom Search API for Google search +![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/3a0f4200-7319-4a2f-8fb1-9d85bffb387a) -https://console.cloud.google.com/apis/api/customsearch.googleapis.com/ \ No newline at end of file From e715c82449bbdf3ac61952b41e78dae3fe705045 Mon Sep 17 00:00:00 2001 From: "system32.eth" <23362597+Raecaug@users.noreply.github.com> Date: Fri, 2 Feb 2024 23:04:34 -0500 Subject: [PATCH 3/8] Update CODE-INTERPRETER.md Added more info about E2B instance limits & duration Signed-off-by: system32.eth <23362597+Raecaug@users.noreply.github.com> --- detailed_guides/CODE-INTERPRETER.md | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/detailed_guides/CODE-INTERPRETER.md b/detailed_guides/CODE-INTERPRETER.md index d1db7b87..046507cc 100644 --- a/detailed_guides/CODE-INTERPRETER.md +++ b/detailed_guides/CODE-INTERPRETER.md @@ -1,17 +1,28 @@ # Code Interpreter -This bot supports a full fledged version of Code Interpreter, where code in various languages can be executed directly in discord. You can even install python and system packages. Python is the preferred language for code interpreter, although it will still work relatively nicely with other popular languages. +This bot supports a full fledged version of Code Interpreter, where code in various languages can be executed directly in Discord. You can even install Python and system packages. Python is the preferred language for code interpreter, although it will still work relatively nicely with other popular languages. -To get started with code interpreter, you need an E2B API key. You can find an E2B API key at https://e2b.dev/docs/getting-started/api-key +To get started with code interpreter, you need an E2B API key. You can find an E2B API key & more info on FoundryLabs [here](https://e2b.dev/docs/getting-started/api-key). ```env E2B_API_KEY="...." ``` -Like above, add the E2B API key to your `.env` file. E2B is a cloud-based isolated execution environment, so that you can run code safely and have a containerized environment to install packages and etc in. +Like above, add the E2B API key to your `.env` file. E2B is a cloud-based isolated execution environment, so that you can run code safely and have a containerized environment to install packages and execute code, etc in. Afterwards, to use code interpreter, simply use `/code chat`. -When you begin a code interpreter instance, a new isolated environment to run your code is automatically created. Inside your chat, you can ask GPT to install python or system packages into this environment, and ask GPT to run any sort of python (and other language) code within it as well. Unlike ChatGPT's code interpreter / advanced data analysis, this also has access to the internet so you can work with code that uses the network as well. +When you begin a code interpreter instance, a new isolated environment to run your code is automatically created. Inside your chat, you can ask GPT to install Python or system packages into this environment, and ask GPT to run any sort of python (and other language) code within it as well. Unlike ChatGPT's code interpreter / advanced data analysis, this also has access to the internet so you can work with code that uses the network as well. -When ChatGPT executes code, sometimes it will create files (especially if you ask it to). If files are created, they can be downloaded from the "Download Artifacts" button that will pop up after the code is executed. -Sometimes, ChatGPT will create files that are not in the upstream `artifacts` folder. To remedy this, simply ask it to ensure all files it makes are within `artifacts`. \ No newline at end of file +As per the E2B documentation, the free tier provides the following resources to a sandboxed code instance: + +> - 2 vCPU +> - 512 MB RAM +> - 1 GB free disk storage +> - 24 hours max sandbox session length + +Given that it is possible to maintain and use a thread over multiple days with GPTDiscord, exceeding the instance limits of your E2B API key will cause the thread to break and not reply. In this case, you will need to end & restart the thread to continue conversing. + + +When ChatGPT executes code, sometimes it will create files (especially if you ask it to within your instructions) in a folder called `artifacts`. If files are created, they can be downloaded from the "Download Artifacts" button that will pop up after the code is executed. + +Sometimes, ChatGPT will create files that are not placed in the upstream `artifacts` folder. To remedy this, simply ask it to ensure all files it makes are within `artifacts`. From 8e95c8664e1927e1bc0dd8b8dc85b84f756c3a2b Mon Sep 17 00:00:00 2001 From: "system32.eth" <23362597+Raecaug@users.noreply.github.com> Date: Fri, 2 Feb 2024 23:19:00 -0500 Subject: [PATCH 4/8] Update INSTALLATION.md Added steps for python venv, should reduce user complaints from installing as root; often the default setup for cloud hosting. Signed-off-by: system32.eth <23362597+Raecaug@users.noreply.github.com> --- detailed_guides/INSTALLATION.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/detailed_guides/INSTALLATION.md b/detailed_guides/INSTALLATION.md index b5acd1be..7f312f2e 100644 --- a/detailed_guides/INSTALLATION.md +++ b/detailed_guides/INSTALLATION.md @@ -111,11 +111,20 @@ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python3.9 get-pip.py ``` +#### Create a Python Virtual Enviroment +```shell +pip install virtualenv +python3.9 -m venv venv +source venv/bin/activate +``` + + #### Install project dependencies ``` python3.9 -m pip install --ignore-installed PyYAML python3.9 -m pip install torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/torch_stable.html python3.9 -m pip install urllib3==1.26.7 +python3.9 -m pip install git+https://github.com/openai/whisper.git python3.9 -m pip install -r requirements.txt python3.9 -m pip install . ``` From 2aaad201aa6f785049fc8c68d4b3bff9d14a90d7 Mon Sep 17 00:00:00 2001 From: "system32.eth" <23362597+Raecaug@users.noreply.github.com> Date: Fri, 2 Feb 2024 23:20:08 -0500 Subject: [PATCH 5/8] Update INSTALLATION.md Type in copy command Signed-off-by: system32.eth <23362597+Raecaug@users.noreply.github.com> --- detailed_guides/INSTALLATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detailed_guides/INSTALLATION.md b/detailed_guides/INSTALLATION.md index 7f312f2e..33ba5b40 100644 --- a/detailed_guides/INSTALLATION.md +++ b/detailed_guides/INSTALLATION.md @@ -131,7 +131,7 @@ python3.9 -m pip install . #### Copy the sample.env file into a regular .env file. `DEBUG_GUILD` and the ID for `ALLOWED_GUILDS` can be found by right-clicking your server and choosing "Copy ID". Similarly, `DEBUG_CHANNEL` can be found by right-clicking your debug channel. ```shell -cp .env .env +cp sample.env .env ``` #### The command below is used to edit the .env file and to put in your API keys. You can right click within the editor after running this command to paste. When you are done editing, press CTRL + X, and then type Y, to save. From db60f05e255b40e5ac01df02739b76f73181ca68 Mon Sep 17 00:00:00 2001 From: "system32.eth" <23362597+Raecaug@users.noreply.github.com> Date: Fri, 2 Feb 2024 23:24:47 -0500 Subject: [PATCH 6/8] Update sample.env Missing env variable Signed-off-by: system32.eth <23362597+Raecaug@users.noreply.github.com> --- sample.env | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sample.env b/sample.env index 69959ef0..9b3b1150 100644 --- a/sample.env +++ b/sample.env @@ -95,3 +95,6 @@ PRE_MODERATE = "False" ## Force only english to be spoken in the server FORCE_ENGLISH = "False" + +## Launch a HTTP endpoint at :8181/ that will return a json response of the bot's status and uptime(good for cloud app containers) +HEALTH_SERVICE_ENABLED="False" From fb8dfb8f91fae34a0b811ae9b907d22dbaabe32f Mon Sep 17 00:00:00 2001 From: "system32.eth" <23362597+Raecaug@users.noreply.github.com> Date: Fri, 2 Feb 2024 23:35:25 -0500 Subject: [PATCH 7/8] Update README.md Small fixes & add legacy DALL-E command Signed-off-by: system32.eth <23362597+Raecaug@users.noreply.github.com> --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e2fa2c79..85233f3f 100644 --- a/README.md +++ b/README.md @@ -125,8 +125,9 @@ These commands are grouped, so each group has a prefix, but you can easily tab c - `/index discord_backup` - Use the last 3000 messages of every channel on your Discord server as an index. Needs both an admin and an index role. - `/index chat user_index: search_index:` - Chat with your documents that you've indexed previously! -### DALL-E2 Commands -- `/dalle draw ` - Have DALL-E generate images based on a prompt. +### DALL-E Commands +- `/dalle draw ` - Have DALL-E 3 generate images based on a prompt. +- `/dalle draw_old ` - Have DALL-E 2 generate images based on a prompt. - `/dalle optimize ` - Optimize a given prompt text for DALL-E image generation. ### System and Settings @@ -135,8 +136,8 @@ These commands are grouped, so each group has a prefix, but you can easily tab c - `/system usage` - Estimate current usage details (based on Davinci). - `/system settings low_usage_mode True/False` - Turn low usage mode on and off. If on, it will use the curie-001 model, and if off, it will use the Davinci-003 model. - `/system delete-conversation-threads` - Delete all threads related to this bot across all servers. -- `/system local-size` - Get the size of the local dalleimages folder. -- `/system clear-local` - Clear all the local dalleimages. +- `/system local-size` - Get the size of the local `/dalleimages` folder. +- `/system clear-local` - Delete all the contents of `/dalleimages`. # Step-by-Step Guides for GPTDiscord [**GPTDiscord Guides**](https://github.com/Kav-K/GPTDiscord/tree/main/detailed_guides) From 6c0da060dfc4a5182210f8335779c7f82ad565ba Mon Sep 17 00:00:00 2001 From: "system32.eth" <23362597+Raecaug@users.noreply.github.com> Date: Sun, 4 Feb 2024 18:55:40 -0500 Subject: [PATCH 8/8] Update INTERNET-CONNECTED-CHAT.md Update screenshots to reflect new UI Signed-off-by: system32.eth <23362597+Raecaug@users.noreply.github.com> --- detailed_guides/INTERNET-CONNECTED-CHAT.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/detailed_guides/INTERNET-CONNECTED-CHAT.md b/detailed_guides/INTERNET-CONNECTED-CHAT.md index 97fe5401..e0d82a0e 100644 --- a/detailed_guides/INTERNET-CONNECTED-CHAT.md +++ b/detailed_guides/INTERNET-CONNECTED-CHAT.md @@ -30,23 +30,21 @@ Follow the on-screen instructions to register a new account. ![image](https://user-images.githubusercontent.com/23362597/232921997-1c6ed4dc-7aea-459b-8d76-95fdf86ee108.png) -4\. Access the Wolfram Developer Portal +4\. Access the [Wolfram Developer Portal](https://developer.wolframalpha.com/access) ------------------------------ -After successful registration, you will be redirected to the Developer Portal: +After successful registration, you will be redirected to the Developer Portal, or follow the link above: -![image](https://user-images.githubusercontent.com/23362597/232922409-92af9237-1230-43dc-836a-7425f31b4f56.png) +![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/a32542c8-7060-4411-a92e-e3eb5ae06433) 5\. Click on "Get an AppID" -------------------------- -![image](https://user-images.githubusercontent.com/23362597/232922639-919f6d5a-da05-4f2c-af4b-5c517a926e78.png) - -6\. Fill in a name and description: +6\. Fill in a name and description and select "Full Results API" from the dropdown: ------------------------------------------------- -![image](https://user-images.githubusercontent.com/23362597/232922798-25b21534-4452-4851-ae72-940b9f9d1fae.png) +![image](https://github.com/Raecaug/GPTDiscord/assets/23362597/173de276-74d9-472c-a513-2420a14e34a7) 8\. Copy the newly generated AppID to your ".env" file