ChatGPT Assistant
This Ruby gem provides an easy way to initialize a client for Telegram and Discord bots using the ChatGPT API, audio transcription, IBM Cloud Text to Speech, and AWS Polly, creating an assistant that can answer questions in text and voice and have a conversation with the user.
Discord Voice Bot temporary disabled due connection issues
Telegram voice messages are working fine
Languages supported currently: en, pt
Registration and Account Confirmation are avaiable on telegram only, sign in with the same credentials on discord after registering on telegram.
Other contributions are welcome too! Remember to give a star to this repo if you like it!
Requirements
- Ruby > 2.6.0 - for the gem who can create bots projects in your machine
- Ruby 3.2.2 - inside the docker container or run the bots in your machine
- Docker
- Docker Compose
- PostgreSQL
- Telegram Bot API Token
- Discord Bot API Token
- IBM Cloud Text to Speech API Key or AWS Polly API Key
- OpenAI API Key
Installation
To install the gem, run:
gem install chatgpt_assistant
Alternatively, you can clone/fork this repo to use it as you wish.
Installation as a gem example
gem install chatgpt_assistant
chatgpt_assistant PATH_TO_FOLDER
cd PATH_TO_FOLDER
cp .env_sample .env
bundle install
Installation as a repo
Run in your terminal:
git clone https://github.com/JesusGautamah/chatgpt_assistant.git
cd chatgpt_assistant
cp .env_sample .env
bundle install
Make sure to run bundle before using the Lucy Dockerunner rake tasks.
Then, edit the .env_sample file to include the necessary credentials and rename it to .env. Run bundle install to install the necessary dependencies.
Remember to edit docker-compose.prod.yml when deploying to production.
Migrate your database
rake compose:up && sudo docker compose run --rm telegram exe/chatgpt_bot migrate
Install Awesome Chatgpt Actors
rake chatgpt_actors:install
Usage
You can start the Docker Compose services required for the gem using the rake tasks provided by the Lucy Dockerunner gem. These tasks include compose:up, compose:down, compose:status, compose:shell, compose:restart, and others listed previously.
For example, to start the services, run:
rake compose:up
To stop the services, run:
rake compose:down
After starting the Docker Compose services, you can use the features of the gem to create a chat assistant that responds to questions in both text and voice using the services mentioned above.
More compose rake tasks at https://github.com/JesusGautamah/lucy_dockerunner
Discord Bot Commands
The discord commands prefix can be changed in the .env file. The default prefix is !!
- !!start - shows the welcome message
- !!help - shows the help message
- !!login email:password - logs in the user. Remember to use private messages to register or login and share a server with right permissions with the bot to message it.
- !!list - lists the user created chatbots
- !!sl_chat CHAT TITLE - starts a chat with the chatbot with the given title
- !!new_chat CHAT TITLE - creates a new chatbot with the given title
- !!ask TEXT - sends a text to the chatbot
Telegram Bot Commands
- /start - shows the welcome message
- /help - shows the help message
- login/email:password - logs in the user. Remember to use private messages to register or login.
- register/email:password - registers a new user, email is not verfied yet, so you can use any email, the password is encrypted with bcrypt and stored in the database with salt. Remember to use private messages to register or login.
- confirm/* name:token - confirms the user account. Remember to use private messages to register or login
- list - lists the user created chatbots
- sl_chat/CHAT TITLE - starts a chat with the chatbot with the given title
- new_chat/CHAT TITLE - creates a new chatbot with the given title
- TEXT - sends a text to the chatbot
- VOICE_MESSAGE or AUDIO FILE - sends a voice message to the chatbot and returns the response in voice
Contributing
A good way to contribute is add your language to DefaultMessages class in lib/chatgpt_assistant/default_messages.rb. You can also add your language to the list of languages in the README.md file.
Bug reports and pull requests are welcome on GitHub at https://github.com/JesusGautamah/chatgpt_assistant. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
/ Recent activity 
Contributors
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the ChatgptAssistant project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.