**PERMANENT MEMORY FOR CONVERSATIONS COMING VERY SOON USING EMBEDDINGS!**
# Recent Major Updates
- **AUTOMATIC CHAT SUMMARIZATION!** - When the context limit of a conversation is reached, the bot will use GPT3 itself to summarize the conversation to reduce the tokens, and continue conversing with you, this allows you to chat for a long time!
- **PERMANENT MEMORY FOR CONVERSATIONS COMING SOON USING EMBEDDINGS!**
- **SLASH COMMANDS!**
- **Image prompt optimizer overhauled** - The optimizer works much better now, and makes beautiful image prompts that work even with Midjourney, SD, etc!
@ -22,15 +24,15 @@
# Features
- **Directly prompt GPT3 with `!g <prompt>`**
- **Directly prompt GPT3 with `/g <prompt>`**
- **Have conversations with the bot, just like chatgpt, with `!g converse`** - Conversations happen in threads that get automatically cleaned up!
- **Have conversations with the bot, just like chatgpt, with `/chat-gpt`** - Conversations happen in threads that get automatically cleaned up!
- **DALL-E Image Generation** - Generate DALL-E AI images right in discord with `!draw <prompt>`! It even supports multiple image qualities, multiple images, creating image variants, retrying, and saving images.
- **DALL-E Image Generation** - Generate DALL-E AI images right in discord with `/draw <prompt>`! It even supports multiple image qualities, multiple images, creating image variants, retrying, and saving images.
- **Redo Requests** - A simple button after the GPT3 response or DALL-E generation allows you to redo the initial prompt you asked.
- **DALL-E Image Prompt Optimization** - Given some text that you're trying to generate an image for, the bot will automatically optimize the text to be more DALL-E friendly!
- **DALL-E Image Prompt Optimization** - Given some text that you're trying to generate an image for, the bot will automatically optimize the text to be more DALL-E friendly!`/imgoptimize <prompt>`
- Automatically re-send your prompt and update the response in place if you edit your original prompt!
@ -104,7 +106,7 @@ After login, we need to install the various dependencies that the bot needs. To
10 python3.9 -m pip install -r requirements.txt
11 python3.9 -m pip install .
12 ls
# Copy the sample.env file into a regular .env file. `DEBUG_GUILD` can be found by right-clicking your server and choosing "Copy ID". Similarly, `DEBUG_CHANNEL` can be found by right-clicking your debug channel.
# 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.
13 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.
@ -149,6 +151,7 @@ This can also be run via screen/tmux or detached like a daemon.
- Bot Permissions will appear, select the desired permissions
- Copy the link generated below and paste it on the browser
- On add to server select the desired server to add the bot
- Make sure you have updated your .env file with valid values for `DEBUG_GUILD`, `DEBUG_CHANNEL` and `ALLOWED_GUILDS`, otherwise the bot will not work. Guild IDs can be found by right clicking a server and clicking `Copy ID`, similarly, channel IDs can be found by right clicking a channel and clicking `Copy ID`.
# Usage
@ -156,28 +159,32 @@ This can also be run via screen/tmux or detached like a daemon.
# Commands
`!g` - Display help text for the bot
`/help` - Display help text for the bot
`/g <prompt>` Ask the GPT3 Davinci 003 model a question.
`/chat-gpt` - Start a conversation with the bot, like ChatGPT
`!g converse` - Start a conversation with the bot, like ChatGPT
`/end-chat` - End a conversation with the bot.
`!g end` - End a conversation with the bot.
`/draw <prompt>` - Have DALL-E generate images based on a prompt
`!draw <prompt>` - Have DALL-E generate images based on a prompt
`/settings` - Display settings for the model (temperature, top_p, etc)
`!gp` - Display settings for the model (temperature, top_p, etc)
`/settings <setting> <value>` - Change a model setting to a new value
`!gs <setting> <value>` - Change a model setting to a new value
`/usage` Estimate current usage details (based on davinci)
`!g <prompt>` Ask the GPT3 Davinci 003 model a question.
`/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.
`!gu` Estimate current usage details (based on davinci)
`/imgoptimize <image prompt text>` Optimize a given prompt text for DALL-E image generation.
`!gs 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.
`/delete_all_conversation_threads` - Delete all threads related to this bot across all servers.
`!imgoptimize <image prompt text>` Optimize a given prompt text for DALL-E image generation.
`/local-size` - Get the size of the local dalleimages folder
`!delete_all_conversation_threads` - Delete all threads related to this bot across all servers.
`/clear-local` - Clear all the local dalleimages.
# Configuration
All the model parameters are configurable inside discord. Type `!gp` to view all the configurable parameters, and use `!gs <param> <value>` to set parameters. For example, if I wanted to change the number of images generated by DALL-E by default to 4, I can type the following command in discord: `!gs num_images 4`
All the model parameters are configurable inside discord. Type `!gp` to view all the configurable parameters, and use `/settings <param> <value>` to set parameters. For example, if I wanted to change the number of images generated by DALL-E by default to 4, I can type the following command in discord: `/settings num_images 4`
awaitctx.reply("Something went wrong. Please try again later.")
awaitctx.reply(e)
awaitctx.respond("Something went wrong. Please try again later.")
awaitctx.send_followup(e)
@commands.command()
asyncdeflocal_size(self,ctx):
@discord.slash_command(name="local-size",description="Get the size of the dall-e images folder that we have on the current system",guild_ids=ALLOWED_GUILDS)
# Create a new discord thread, and then send the conversation starting message inside of that thread
ifnot("nothread"inprompt):
message_thread=awaitmessage.channel.send(
message.author.name+"'s conversation with GPT3"
)
thread=awaitmessage_thread.create_thread(
name=message.author.name+"'s conversation with GPT3",
auto_archive_duration=60,
)
awaitthread.send(
"<@"
+str(message.author.id)
+"> You are now conversing with GPT3. *Say hi to start!*\n End the conversation by saying `end`.\n\n If you want GPT3 to ignore your messages, start your messages with `~`\n\nYour conversation will remain active even if you leave this thread and talk in other GPT supported channels, unless you end the conversation!"
"You are now conversing with GPT3. *Say hi to start!*\n End the conversation by saying `end`.\n\n If you want GPT3 to ignore your messages, start your messages with `~`\n\nYour conversation will remain active even if you leave this thread and talk in other GPT supported channels, unless you end the conversation!"
)
return
# If the prompt is just "end", end the conversation with GPT3
ifprompt=="end":
# If the user is not conversating, don't let them end the conversation
ifmessage.author.idnotinself.conversating_users:
awaitmessage.reply(
"**You are not conversing with GPT3.** Start a conversation with `!g converse`"
)
return
# If the user is conversating, end the conversation
awaitself.end_conversation(message)
return
awaitself.check_conversation_limit(message)
# We want to have conversationality functionality. To have gpt3 remember context, we need to append the conversation/prompt
# history to the prompt. We can do this by checking if the user is in the conversating_users dictionary, and if they are,
@ -694,6 +463,8 @@ class GPT3ComCon(commands.Cog, name="GPT3ComCon"):
+"> You are now conversing with GPT3. *Say hi to start!*\n End the conversation by saying `end`.\n\n If you want GPT3 to ignore your messages, start your messages with `~`\n\nYour conversation will remain active even if you leave this thread and talk in other GPT supported channels, unless you end the conversation!"
)
self.conversation_threads[user.id]=thread.id
@discord.slash_command(name="end-chat",description="End a conversation with GPT3",guild_ids=ALLOWED_GUILDS)
You're a regular discord user, be friendly, casual, and fun, speak with "lol", "haha", and etc when it seems fitting, and use emojis in your responses in a way that makes sense, avoid repeating yourself at all costs. Never say "<|endofstatement|>".
You're a regular discord user, be friendly, casual, and fun, speak with "lol", "haha", and etc when it seems fitting, and use emojis in your responses in a way that makes sense, avoid repeating yourself at all costs. Never say "<|endofstatement|>". Never say "GPTie:" in your response either.
self._frequency_penalty=0# Penalize new tokens based on their existing frequency in the text so far. (Higher frequency = lower probability of being chosen.)
self._best_of=1# Number of responses to compare the loglikelihoods of