RAHB-REALTORS-Association / chat2gpt

Chat²GPT is a ChatGPT (and DALL·E 2/3, and ElevenLabs) chat bot for Google Chat. 🤖💬
https://chat2gpt.oncornerstone.app
MIT License
11 stars 1 forks source link
ai bootstrap dall-e docker elevenlabs flask google-chat google-chat-bot google-cloud openai python text-to-speech

Python 3.11 GCP Deployment Docker Image License: MIT

Logo


Chat²GPT is a ChatGPT chat bot for Google Chat 🤖💬. It's designed to amplify the experience in your Google Chat rooms by offering personalized user sessions for coherent dialogues, a manual reset capability, the power to generate images via OpenAI's DALL·E 2 API, and dynamic interactions through mentions or direct messaging. Moreover, with the integration of ElevenLabs' Text-to-Speech API, Chat²GPT now brings voice interactions, letting users convert textual prompts into audio. User input and text output is moderated with OpenAI's Moderation API.

📖 Table of Contents

🛠️ Setup

Run on Google Cloud

This bot is intended to be deployed on Google Cloud Functions, with audio data temporarily stored in Google Cloud Storage. Its continuous deployment pipeline is managed using GitHub Actions.

Follow these steps to setup your Chat²GPT bot:

1. Clone the Repository 📁

Clone this repository to your local machine using the command:

git clone https://github.com/RAHB-REALTORS-Association/chat2gpt.git

2. Create Google Cloud Project ☁️

Create a new project in your Google Cloud Console or select an existing one.

3. Create a Service Account and JSON Key 📑

In the Google Cloud Console:

When assigning roles to your service account:

4. Set GitHub Secrets 🔒

In your GitHub repository:

5. GitHub Actions 🚀

The bot's deployment to Google Cloud Functions and Storage gets automatically handled by the GitHub Actions workflow upon pushing changes to the main branch.

6. Configure Bot Access 🤝

Now, your bot can be added to any room within your Google Workspace.

👷 Development

The server.py script included in this repository serves as a lightweight, local development server for Chat²GPT. This enables you to test new features, debug issues, or get a firsthand experience of the chatbot's capabilities without deploying it to a production environment. Running the server starts a web service that you can access at http://127.0.0.1:5000.

Setup

The following are only applicable if using the server.py script or Docker:

Docker 🐳

To quickly set up and run the Chat²GPT application, you can use the pre-built Docker image available at ghcr.io/rahb-realtors-association/chat2gpt:latest. Below are the steps and options for running the Docker container:

  1. Basic Usage

    Run the following command to pull the image and start a container:

    docker run -d -e OPENAI_API_KEY=sk-myopenaisecretapikey -p 5000:5000 --name chat2gpt ghcr.io/rahb-realtors-association/chat2gpt:latest
  2. Additional Options

    To load from .env file or persist logs, use volume mapping:

    docker run -d -v ./.env:/app/.env -v ./chat2gpt-server-log.txt:/app/chat2gpt-server-log.txt -e LOG_FILE=chat2gpt-server-log.txt -p 5000:5000 ghcr.io/rahb-realtors-association/chat2gpt:latest

    To access an API_URL running on the Docker host, use host networking:

    docker run -d -e API_URL=http://127.0.0.1:1234/v1/chat/completions --network host --name chat2gpt ghcr.io/rahb-realtors-association/chat2gpt:latest

The server should start successfully and can be accessed at http://127.0.0.1:5000.

Ubuntu 🤓

To run Chat²GPT on Ubuntu, follow these steps:

  1. Update Packages

    Open Terminal and update your package list:

    sudo apt update
  2. Install Required Dependencies

    Install Python and other necessary packages:

    sudo apt install python3 python3-pip git
  3. Clone the Repository

    Clone the Chat²GPT repository:

    git clone https://github.com/RAHB-REALTORS-Association/chat2gpt.git

    Navigate to the cloned directory:

    cd chat2gpt
  4. Install Python Packages

    Install the required Python packages:

    pip3 install -r requirements.txt
  5. Run the Server

    Start the Chat²GPT server:

    python3 server.py

The server should start successfully and can be accessed at http://127.0.0.1:5000.

macOS 🍎

To run Chat²GPT on macOS, you can use Homebrew to manage your packages. Follow these steps:

  1. Install Homebrew

    If you don't have Homebrew installed, open Terminal and run:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Install Python

    Install Python using Homebrew:

    brew install python
  3. Clone the Repository

    Clone the Chat²GPT repository:

    git clone https://github.com/RAHB-REALTORS-Association/chat2gpt.git

    Navigate to the cloned directory:

    cd chat2gpt
  4. Install Python Packages

    Install the required Python packages:

    pip3 install -r requirements.txt
  5. Run the Server

    Start the Chat²GPT server:

    python3 server.py

The server should start successfully and can be accessed at http://127.0.0.1:5000.

Android 🤖

To run Chat²GPT on an Android device using Termux, follow these steps:

  1. Update and Upgrade Termux Packages

    Open Termux and run the following command to update and upgrade existing packages:

    pkg upgrade
  2. Install Required Dependencies

    Install the necessary packages like OpenSSL, Python, pip, Git, Rust, and Binutils by executing:

    pkg install openssl python python-pip git rust binutils
  3. Clone the Repository

    Use the git command to clone the Chat²GPT repository to your device:

    git clone https://github.com/RAHB-REALTORS-Association/chat2gpt.git

    Navigate to the cloned directory:

    cd chat2gpt
  4. Install Python Packages

    Run the following command to install the Python packages required for Chat²GPT:

    pip install -r requirements.txt
  5. Run the Server

    Finally, start the Chat²GPT server using the python command:

    python server.py

The server should start successfully and can be accessed at http://127.0.0.1:5000.

🧑‍💻 Usage

Remember, Chat²GPT is flexible, suitable for deployment on Google Cloud, FaaS (Function as a Service), or PaaS (Platform as a Service) environments, ensuring it's a perfect fit for all your Google Chat endeavors.

Commands ⌨️

Use the following commands for Chat²GPT:

🛡️ Privacy

Data Practices 📝

AI APIs and User Awareness ℹ️

🌐 Community

Contributing 👥

Contributions of any kind are very welcome, and would be much appreciated. 🙏 For Code of Conduct, see Contributor Covenant.

To get started, fork the repo, make your changes, add, commit and push the code, then come back here to open a pull request. If you're new to GitHub or open source, this guide or the git docs may help you get started, but feel free to reach out if you need any support.

Submit a PR

Reporting Bugs 🐛

If you've found something that doesn't work as it should, or would like to suggest a new feature, then go ahead and raise an issue on GitHub. For bugs, please outline the steps needed to reproduce, and include relevant info like system info and resulting logs.

Raise an Issue

📄 License

This project is open sourced under the MIT license. See the LICENSE file for more info.