Merge pull request #159 from Raecaug/docker-setup-fixes

Adding enviroment variables & documentation fixes.
Kaveen Kumarasinghe 2 years ago committed by GitHub
commit b48306be44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,17 +2,19 @@
**For OCR, and document functionalities**: **For OCR, and document functionalities**:
``` ```
pip3 install torch==1.9.1+cpu torchvision==0.10.1+cpu -f https://download.pytorch.org/whl/torch_stable.html pip3 install torch==1.9.1+cpu torchvision==0.10.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
or ```
OR
```
python3.9 -m pip install torch==1.9.1+cpu torchvision==0.10.1+cpu -f https://download.pytorch.org/whl/torch_stable.html python3.9 -m pip install torch==1.9.1+cpu torchvision==0.10.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
``` ```
**For audio extraction for indexing from .mp3 and .mp4 files**: **For audio extraction for indexing from .mp3 and .mp4 files**:
```
`python3.9 -m pip install git+https://github.com/openai/whisper.git` python3.9 -m pip install git+https://github.com/openai/whisper.git
```
**All other dependencies**: **All other dependencies**:
```
`python3.9 -m pip install -r requirements.txt` python3.9 -m pip install -r requirements.txt
```
**We recommend using python 3.9.** **We recommend using python 3.9.**
OpenAI API Key (https://beta.openai.com/docs/api-reference/introduction) OpenAI API Key (https://beta.openai.com/docs/api-reference/introduction)
@ -77,7 +79,7 @@ To connect with ssh, run the following command in terminal:
It will then prompt you for your password, which you should enter, and then you will be logged in. It will then prompt you for your password, which you should enter, and then you will be logged in.
After login, we need to install the various dependencies that the bot needs. To do this, we will run the following commands: After login, we need to install the various dependencies that the bot needs. To do this, we will run the following commands:
```bash ```
git clone https://github.com/Kav-K/GPT3Discord.gitcd GPT3Discord/ git clone https://github.com/Kav-K/GPT3Discord.gitcd GPT3Discord/
# Install system packages (python) # Install system packages (python)
sudo apt-get updatesudo apt install software-properties-commonsudo add-apt-repository ppa:deadsnakes/ppasudo apt install python3.9sudo apt install python3.9-distutils # If this doesn't work, try sudo apt install python3-distutils sudo apt-get updatesudo apt install software-properties-commonsudo add-apt-repository ppa:deadsnakes/ppasudo apt install python3.9sudo apt install python3.9-distutils # If this doesn't work, try sudo apt install python3-distutils
@ -94,24 +96,27 @@ nano .env
screen gpt3discord screen gpt3discord
# Hit `Ctrl+a` then `d` to detach from the running bot. # Hit `Ctrl+a` then `d` to detach from the running bot.
# The bot's screen session can be reattached: # The bot's screen session can be reattached:
screen -r``` screen -r
```
If the last few commands don't allow the bot to run `screen gpt3discord`, you can attempt to run the bot another way: If the last few commands don't allow the bot to run `screen gpt3discord`, you can attempt to run the bot another way:
```bash ```
{Navigate to the folder where the project files are} # First, navigate to the folder where the project files are
screen -dmS GPTBot bash -c 'python3.9 gpt3discord.py' screen -dmS GPTBot bash -c 'python3.9 gpt3discord.py'
# Reattach to screen session # Reattach to screen session
screen -x # will reattach if this is the only screen session, if there are multiple, it will show IDs screen -x # will reattach if this is the only screen session, if there are multiple, it will show IDs
# If there are multiple IDs returned by screen -x: # If there are multiple IDs returned by screen -x:
screen -d -r {ID} # replace {ID} with the ID of the screen session you want to reattach to screen -d -r {ID} # replace {ID} with the ID of the screen session you want to reattach to
``` ```
As a last resort, you can try to run the bot using python in a basic way, with simply As a last resort, you can try to run the bot using python in a basic way, with simply
```bash ```
cd (the folder where the files for GPT3Discord are located/cloned) cd GPT3Discord
python3.9 gpt3discord.py```
python3.9 gpt3discord.py
```
<!-- <!--
### Docker Installation ### Docker Installation
@ -158,7 +163,7 @@ To start the gpt3discord container with Docker Compose, follow these steps:
3. Run the following command to start the container in detached mode: 3. Run the following command to start the container in detached mode:
``` ```
Copy codedocker-compose up -d docker-compose up -d
``` ```
This will start the container and use the settings in the docker-compose.yml file. The -d option tells Docker Compose to run the container in the background (detached mode). This will start the container and use the settings in the docker-compose.yml file. The -d option tells Docker Compose to run the container in the background (detached mode).
@ -167,7 +172,7 @@ This will start the container and use the settings in the docker-compose.yml fil
To stop the gpt3discord container, run the following command: To stop the gpt3discord container, run the following command:
``` ```
Copy codedocker-compose down docker-compose down
``` ```
This will stop the container and remove the services and networks defined in the docker-compose.yml file. This will stop the container and remove the services and networks defined in the docker-compose.yml file.
@ -181,27 +186,31 @@ You need to install python3.9 and pip for python3.9 on your system.
With python3.9 installed and the requirements installed, you can run this bot anywhere. With python3.9 installed and the requirements installed, you can run this bot anywhere.
Install the dependencies with: Install the dependencies with:
`pip3 install torch==1.9.1+cpu torchvision==0.10.1+cpu -f https://download.pytorch.org/whl/torch_stable.html` ```
`python3.9 -m pip install -r requirements.txt` pip3 install torch==1.9.1+cpu torchvision==0.10.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
Then, run the bot with: python3.9 -m pip install -r requirements.txt
`python3.9 gpt3discord.py` ```
Then, run the bot with:
```
python3.9 gpt3discord.py
```
Here's a great video from a community member that shows an installation on Windows: https://youtu.be/xLhwS2rQg14 Here's a great video from a community member that shows an installation on Windows: https://youtu.be/xLhwS2rQg14
## Updating ## Updating
To update the bot, To update the bot, run (when working in the directory of GPT3discord):
run (when working in the directory of GPT3discord):
```bash ```
#To get the latest branch: # To get the latest branch:
git pull git pull
#Install the latest modules so the bot keeps working. # Install the latest modules so the bot keeps working.
python3.9 -m pip install -r requirements.txt python3.9 -m pip install -r requirements.txt
python3.9 -m pip install . python3.9 -m pip install .
``` ```

@ -6,12 +6,21 @@ services:
environment: environment:
OPENAI_TOKEN: "<openai_api_token>" OPENAI_TOKEN: "<openai_api_token>"
DISCORD_TOKEN: "<discord_bot_token>" DISCORD_TOKEN: "<discord_bot_token>"
PINECONE_TOKEN: "<pinecone_api_token>"
PINECONE_REGION: "<pinecone_region>"
DEBUG_GUILD: "974519864045756446" DEBUG_GUILD: "974519864045756446"
DEBUG_CHANNEL: "977697652147892304" DEBUG_CHANNEL: "977697652147892304"
ALLOWED_GUILDS: "971268468148166697,971268468148166697" ALLOWED_GUILDS: "971268468148166697,971268468148166697"
GOOGLE_SEARCH_API_KEY: "<google_api_key>"
GOOGLE_SEARCH_ENGINE_ID: "<google_engine_id>"
DEEPL_TOKEN: "<deepl_token>"
ADMIN_ROLES: "Admin,Owner" ADMIN_ROLES: "Admin,Owner"
DALLE_ROLES: "Admin,Openai,Dalle,gpt" DALLE_ROLES: "Admin,Openai,Dalle,gpt"
GPT_ROLES: "openai,gpt" GPT_ROLES: "openai,gpt"
TRANSLATOR_ROLES: "Admin,Owner"
INDEX_ROLES: "Admin,Owner"
SEARCH_ROLES: "Admin,Owner"
CUSTOM_BOT_NAME: "GPT3Discord"
WELCOME_MESSAGE: "Hi There! Welcome to our Discord server. We hope you'll enjoy our server and we look forward to engaging with you!" WELCOME_MESSAGE: "Hi There! Welcome to our Discord server. We hope you'll enjoy our server and we look forward to engaging with you!"
USER_INPUT_API_KEYS: "False" USER_INPUT_API_KEYS: "False"
MODERATIONS_ALERT_CHANNEL: "977697652147892304" MODERATIONS_ALERT_CHANNEL: "977697652147892304"

Loading…
Cancel
Save