FoxyMoe is a discord bot written with discord.js. This is a chat bot that communicates via the oobabooga webui API.
Chat Bot Showcase
showcase_ai_txt.mp4
Table of Contents
FoxyMoe was a project I started around 2022 as a joke between friends. At the time, the main objective was to make the bot join a voice channel and use MoeGoe for TTS. However, MoeGoe stopped receiving updates the same year and encountered problems with certain characters, causing the bot to be unstable. Around one year later, I decided to pick back that project and rewrite most of the code, a V2, and this time focused on the other half of the original idea, the chat bot (with LLM).
- Node.js
- Oobabooga WebUI (Github repo) Follow the installation procedure in their readme
Caution
The chat bot showcase was done on oobabooga webui v1.10.1. If you plan to use embeddings (vector search) for the long term memory, you may have a problem with oobabooga as a module is missing. Please refer to this issue to correct it.
This guide assume your already have installed Oobabooga webui, a model inside the webui and created a Discord Bot.
-
Go into the root folder of your Oobabooga installation and locate the
CMD_FLAGS.TXT
file. Ensure that you have enabled the--api
flag. Here's a example of a correct configuration:# Only used by the one-click installer. # Example: # --listen --api --api
-
Clone this repo or download it as a zip file
git clone https://github.com/kitsumed/FoxyMoe-DiscordBot
-
Open a cmd into the root of the repo and install the npm packages of the project
npm install
-
Create a .env file in the root of the repo and configure your environement file with the following settings:
If you are unsure about your LLM informations, go back to where you downloaded the model, example of the Instruction Template and chat mode should be mentioned.
TOKEN=YOUR_DISCORD_BOT_TOKEN ClientID=YOUR_DISCORD_BOT_CLIENT_ID GuildID=YOUR_DISCORD_SERVER_ID OobaboogaApiEndpoint=http://127.0.0.1:5000 OobaboogaModelName=YOUR_MODEL_NAME OobaboogaUseEmbeddings=true/false OobaboogaChatMode=YOUR_MODEL_SUPPORTED_MODE OobaboogaInstructionTemplateName=YOUR_MODEL_INSTRUCTION_TEMPLATE ChatAiChannelID=YOUR_DISCORD_CHANNEL_ID
Note
Some values like the prompt temperature are hard-coded inside the ObaBogaAPI module. All Models should always work as the hard-coded values are only having a effect on the LLM completion generation, but they won't always achieve the best results possible.
- Deploy the commands to your Discord guild
node .\deploy-commands.js
These are just the basics; other commands are also available.
Once you completed the installation steps, go into the project root directory and start the bot with
node .\index.js
During it's first execution, the bot should create a SQLite database.
To create a ObaBogaInstance, go into your discord server and write /config ai_text_generation manage action:Create
.
Each instance has it's own system prompt and chat history and you can switch between them without restarting the bot.
For better results, I recommend including conversasion example at the end of your system prompt. If your bot name is potato
and your user name is chicken
the example should follow this format
chicken: Hi there
potato: Hi user, how do you feel today?
chicken: I feel great!
To load a ObaBogaInstance, go into your discord server and write /config ai_text_generation select id:VALUE
.
Note that if you've restarted the bot after loading a ObaBogaInstance, the bot will load the last used instance by default.
Warning
If you're updating the instance currently loaded, you will need to reload the instance to get the new configuration
To edit a ObaBogaInstance, go into your discord server and write /config ai_text_generation edit id:VALUE
.
To clear your chat history, go into your discord server and write /config ai_text_generation clear
.
- Implement chat bot functionality with Oobabooga webui
- Implement TTS with vits-simple-api
- Implement voice to text with whisper (Preferably locally with an API)
Note
Before making a pull request, please ensure that your code is easily readable and contains good enough comments in English. This will make it easy for everyone to understand the project.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. Don't forget to give the project a star! Thanks again!