This project implements an AI-powered chatbot that integrates with Signal messenger, allowing users to interact with various AI models (Gemini and Flux right now) through Signal messages.
- Interaction with AI models (Gemini) via Signal messages
- Image generation capabilities (using Flux and LoRAs)
- Session management for continuous conversations
- Command system for changing bot settings
- A dedicated phone number for the Signal bot
- A device to link the Signal app to the API
- signal-cli-rest-api set up and running. Use the
json-rpc
for faster chat responses. The command could look like this:podman run -p 8080:8080 \ -v $HOME/.local/share/signal-api:/home/.local/share/signal-cli \ -e 'MODE=json-rpc' docker.io/bbernhard/signal-cli-rest-api
-
Clone the repository:
git clone https://github.com/yourusername/signal-ai-chat.git cd signal-ai-chat
-
Set up a virtual environment and install dependencies:
python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt
-
Set up the required environment variables:
export GOOGLE_AI_STUDIO_API="your_google_ai_studio_api_key" export SIGNAL_PHONE_NUMBER="your_signal_bot_phone_number" export TRUSTED_PHONE_NUMBERS="comma,separated,list,of,trusted,numbers" export FAL_KEY="your_fal_ai_key" # Optional, for image generation export LORA_PATH_TO_URL='{"triggerword": "<url>"}' # Optional, for LoRA models export PROMPT_REPLACE_DICT='{"replace this": "to this", "and this": "to this"}' # Optional
-
Run the Signal AI bot:
python src/main.py
Once the bot is running, you can interact with it via Signal messages. Available commands include:
!help
: Show help message!cp [prompt_name]
: Change system prompt!cm <model_number>
: Change AI model!cup <custom_prompt>
: Set a custom system prompt!im <prompt>
: Generate an image (trusted users only)!is <size_number>
: Change image size
You can customize various settings in the config.py
file, including:
- Available AI models
- System instructions/personalities
- Image sizes
- Trusted phone numbers
- API endpoints
- Run on a Raspberry PI Zero 2W
- Use function calling for the bot with useful functions
- Use the bot in groupe chats
Contributions are welcome! Please feel free to submit a Pull Request.
More generative art, statistics or other projects of me can be found here: piebro.github.io.
This project is licensed under the MIT License. See the LICENSE file for details.