RoboFriend is a Dockerized AI-powered penpal application. It uses an AI model to generate engaging email responses and a mailer service to send and receive emails. The application is composed of three main services:
- AI Service: Uses an AI model to generate email responses and summarize discussions.
- Mailer Service: Sends and receives emails, managing the communication with your penpal.
- MongoDB service: Stores the email exchanges and current summary between RoboFriend and the user.
Here's an overview of the project structure:
docker
├── df
│ ├── Dockerfile.ai # Dockerfile for the AI service
│ ├── Dockerfile.mailer # Dockerfile for the mailer service
│ ├── ai_data
│ │ ├── ai_penpal.py # AI penpal logic
│ │ ├── discussion_summary.py # Discussion summarization logic
│ │ ├── maildb.py # Database interaction module for AI service
│ │ ├── openai.key # API key for OpenAI GPT model
│ │ └── requirements.txt # Python dependencies for the AI service
│ └── mailer_data
│ ├── maildb.py # Database interaction module for mailer service
│ ├── penpal_mailer.py # Email sending and receiving logic
│ ├── requirements.txt # Python dependencies for the mailer service
│ └── token.json # OAuth2 token for Google API
├── docker-compose.yaml # Docker Compose configuration file
└── init-mongo.sh # Initialization script for MongoDB
- Docker
- Docker Compose
- A Google API OAuth2 token for accessing Gmail (follow these instructions to obtain a token)
- An OpenAI API key for using the GPT model (sign up on OpenAI's platform to get an API key)
-
Clone this repository:
git clone https://github.com/tznurmin/robofriend.git cd robofriend/docker
-
Add your OpenAI API key to
df/ai_data/openai.key
. -
Add your Google API OAuth2 token to
df/mailer_data/token.json
. -
Edit the
docker-compose.yaml
file to configure the project details. -
Build and run the application using Docker Compose:
docker-compose up -d
-
Your RoboFriend is now up and running! The AI service will start generating email responses and the mailer service will send and receive emails.
Once the application is running, simply send an email to the configured email address. In the email address's local part (the part before the '@' symbol), include a plus sign (+) followed by a user ID to uniquely identify the user. This helps the AI service differentiate between different users and maintain separate conversation histories for each user. The AI service will generate a response based on the summary stored in the MongoDB service, and the mailer service will send the email to the recipient.
For example, if your configured email address is robofriend@example.com and the user ID is john123, the email should be sent to robofriend+john123@example.com.
To stop the running containers and remove the associated resources, execute the following command in the project directory:
docker-compose down
This project is licensed under the MIT License. See the LICENSE file for more details.