From 4b3201db0d6f8ff4a19ac1a414b302b7078a3dbd Mon Sep 17 00:00:00 2001 From: Rene Teigen Date: Sat, 14 Jan 2023 16:53:05 +0000 Subject: [PATCH] Update readme and sample.env Small change to text service --- README.md | 34 +++++++++++++++++++--------------- pyproject.toml | 5 +++-- sample.env | 1 + services/text_service.py | 6 +----- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index ccf7bfd..bf827e9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![PyPi](https://github.com/Kav-K/GPT3Discord/actions/workflows/pypi_upload.yml/badge.svg) ![Build](https://github.com/Kav-K/GPT3Discord/actions/workflows/build.yml/badge.svg) -[![PyPi version](https://badgen.net/pypi/v/gpt3discord/)](https://pypi.com/project/gpt3discord) +[![PyPi version](https://badgen.net/pypi/v/gpt3discord/)](https://pypi.org/project/gpt3discord) [![Latest release](https://badgen.net/github/release/Kav-K/GPT3Discord)](https://github.com/Kav-K/GPT3Discord/releases) [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Kav-K/GPT3Discord/graphs/commit-activity) [![GitHub license](https://img.shields.io/github/license/Kav-K/GPT3Discord)](https://github.com/Kav-K/GPT3Discord/blob/master/LICENSE) @@ -134,7 +134,7 @@ These commands are grouped, so each group has a prefix but you can easily tab co If you'd like to help us test and fine tune our thresholds for the moderation service, please join this test server: https://discord.gg/CWhsSgNdrP. You can let off some steam in a controlled environment ;) -** The above server is NOT for support or discussions about GPT3Discord ** +**The above server is NOT for support or discussions about GPT3Discord** # Permanent Memory Permanent memory has now been implemented into the bot, using the OpenAI Ada embeddings endpoint, and Pinecone DB. @@ -230,26 +230,30 @@ You also need to add the allowed guilds that the bot can operate on, this is the You also need to add the roles that can use the bots various features, scroll down a bit to "Permissions", and check out the sample environment file below. -``` -OPENAI_TOKEN="" -DISCORD_TOKEN="" -DEBUG_GUILD="974519864045756446" #discord_server_id -DEBUG_CHANNEL="977697652147892304" #discord_chanel_id -ALLOWED_GUILDS="971268468148166697,971268468148166697" +```shell +OPENAI_TOKEN = "" +DISCORD_TOKEN = "" +#PINECONE_TOKEN = "" # pinecone token if you have it enabled. See readme +DEBUG_GUILD = "974519864045756446" # discord_server_id +DEBUG_CHANNEL = "977697652147892304" # discord_chanel_id +ALLOWED_GUILDS = "971268468148166697,971268468148166697" # People with the roles in ADMIN_ROLES can use admin commands like /clear-local, and etc -ADMIN_ROLES="Admin,Owner" +ADMIN_ROLES = "Admin,Owner" # People with the roles in DALLE_ROLES can use commands like /dalle draw or /dalle imgoptimize -DALLE_ROLES="Admin,Openai,Dalle,gpt" +DALLE_ROLES = "Admin,Openai,Dalle,gpt" # People with the roles in GPT_ROLES can use commands like /gpt ask or /gpt converse -GPT_ROLES="openai,gpt" -WELCOME_MESSAGE="Hi There! Welcome to our Discord server. We hope you'll enjoy our server and we look forward to engaging with you!" # This is a fallback message if gpt3 fails to generate a welcome message. -# This is the channel that auto-moderation alerts will be sent to -MODERATIONS_ALERT_CHANNEL="977697652147892304" +GPT_ROLES = "openai,gpt" +WELCOME_MESSAGE = "Hi There! Welcome to our Discord server. We hope you'll enjoy our server and we look forward to engaging with you!" # This is a fallback message if gpt3 fails to generate a welcome message. +USER_INPUT_API_KEYS="False" # If True, users must use their own API keys for OpenAI. If False, the bot will use the API key in the .env file. +# Moderations Service alert channel, this is where moderation alerts will be sent as a default if enabled +MODERATIONS_ALERT_CHANNEL = "977697652147892304" +# User API key db path configuration. This is where the user API keys will be stored. +USER_KEY_DB_PATH = user_key_db.sqlite ``` **Permissions** -As mentioned in the comments of the sample environment file, there are three permission groups that you can edit in the environment (`.env`) file. `ADMIN_ROLES` are roles that allow users to use `/system` commands. `GPT_ROLES` are roles that allow users to use `/gpt` commands, and `DALLE_ROLES` are roles that allow users to use `/dalle` commands. +As mentioned in the comments of the sample environment file, there are three permission groups that you can edit in the environment (`.env`) file. `ADMIN_ROLES` are roles that allow users to use `/system` and `/mod` commands. `GPT_ROLES` are roles that allow users to use `/gpt` commands, and `DALLE_ROLES` are roles that allow users to use `/dalle` commands. Optionally, you can include your own conversation starter text for the bot that's used with `/gpt converse`, with `CONVERSATION_STARTER_TEXT` diff --git a/pyproject.toml b/pyproject.toml index c430571..3f4593c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,14 +44,15 @@ path = "gpt3discord.py" include = [ "cogs/*.py", "models/*.py", + "services/*.py" "gpt3discord.py", ] #[tool.hatch.build.targets.sdist] -#packages = ["cogs", "gpt3discord.py", "models"] +#packages = ["cogs", "gpt3discord.py", "models", "services"] #[tool.hatch.build.targets.wheel] -#packages = ["cogs", "gpt3discord.py", "models"] +#packages = ["cogs", "gpt3discord.py", "models", "services"] [[tool.hatch.envs.test.matrix]] python = ["39"] diff --git a/sample.env b/sample.env index 9648ca5..0dff237 100644 --- a/sample.env +++ b/sample.env @@ -1,5 +1,6 @@ OPENAI_TOKEN = "" DISCORD_TOKEN = "" +#PINECONE_TOKEN = "" # pinecone token if you have it enabled. See readme DEBUG_GUILD = "974519864045756446" # discord_server_id DEBUG_CHANNEL = "977697652147892304" # discord_chanel_id ALLOWED_GUILDS = "971268468148166697,971268468148166697" diff --git a/services/text_service.py b/services/text_service.py index 51a27c4..ceb7d22 100644 --- a/services/text_service.py +++ b/services/text_service.py @@ -395,11 +395,7 @@ class TextService: converser_cog.generate_debug_message(prompt, response), converser_cog.debug_channel ) - if ctx.author.id in converser_cog.awaiting_responses: - converser_cog.awaiting_responses.remove(ctx.author.id) - if not from_ask_command and not from_edit_command: - if ctx.channel.id in converser_cog.awaiting_thread_responses: - converser_cog.awaiting_thread_responses.remove(ctx.channel.id) + converser_cog.remove_awaiting(ctx.author.id, ctx.channel.id, from_ask_command, from_edit_command) # Error catching for AIOHTTP Errors except aiohttp.ClientResponseError as e: