Skip to content

AbdulWahabIlahi/ai-waifu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌸 AI Waifu Bot

Python 3.9+ Telegram Mistral AI License: MIT

An adorable and emotionally-intelligent Telegram chatbot that responds with anime-style stickers, emojis, and AI-generated images based on sentiment analysis.

πŸ“‹ Table of Contents

🌟 Overview

AI Waifu Bot transforms your Telegram experience with an adorable AI companion that:

  • Engages in natural, context-aware conversations
  • Responds with cute anime stickers and emojis based on emotional context
  • Generates custom anime-inspired images reflecting the bot's feelings
  • Features a customizable personality to match your preferences

Perfect for anime enthusiasts, chatbot developers, and anyone looking for a unique AI interaction experience!

✨ Features

  • πŸ’¬ Personalized AI Conversations: Powered by Mistral AI for responsive, context-aware interactions
  • 🎭 Sentiment Analysis: Automatically detects emotions in messages and responds appropriately
  • πŸ–ΌοΈ Dynamic Sticker Responses: Selects and sends anime stickers based on conversation sentiment
  • 😊 Emoji Integration: Sends contextually relevant emojis matching the emotional tone
  • 🎨 AI Image Generation: Creates custom anime-style images reflecting the character's emotions and actions
  • πŸ’– Customizable Personality: Bot's personality can be adjusted through the starter prompt

πŸ“Ή Demo

AI Waifu Bot Demo

Click to watch the demo video

πŸ“Έ More Screenshots
Chat example

Example chat interaction

Generated image example

Example of a generated image

πŸ”§ Technology Stack

Category Technologies
Backend Python
AI Models Mistral AI
Integration Telegram Gradio
Libraries TextBlob Pillow

πŸ“‹ Prerequisites

  • Python 3.9 or higher
  • Telegram Bot Token (from BotFather)
  • Mistral AI API Key (from Mistral AI)

πŸš€ Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/ai_waifu_bot.git
    cd ai_waifu_bot
  2. Create and activate a virtual environment:

    python -m venv env
    source env/bin/activate  # On Windows: env\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Set up your configuration:

    • Update your Telegram Bot Token in bot.py
    • Add your Mistral AI API Key in bot.py
    • Customize the starter prompt to change the bot's personality

πŸ’» Usage

  1. Start the bot:

    python bot.py
  2. Open Telegram and search for your bot (by username)

  3. Start chatting with /start command

  4. Enjoy interactions with your AI waifu, complete with stickers and emojis!

Example usage

Simple interaction example

πŸ”Ž Understanding the Bot

AI Waifu Bot processes conversations through an intelligent pipeline:

  1. Conversation Flow: User messages are processed by Mistral AI to generate contextually appropriate responses
  2. Emotional Analysis: TextBlob analyzes the sentiment of AI responses and maps them to specific emotions
  3. Response Enhancement: Based on detected emotions, the bot selects appropriate stickers or emojis
  4. Optional Image Generation: For visual responses, the bot can generate custom anime-style images
πŸ’‘ Emotion Categories

The bot recognizes these core emotions:

  • Love: Strong positive sentiment (❀️)
  • Grinning: Very positive sentiment (😁)
  • Happy: Moderately positive sentiment (😊)
  • Shy: Slightly positive/uncertain sentiment (πŸ™ˆ)
  • Angry: Strong negative sentiment (😠)
  • Sad: Moderately negative sentiment (😒)

πŸ“ Project Structure

ai_waifu_bot/
β”œβ”€β”€ bot.py                # Main application entry point
β”œβ”€β”€ sticker_selector.py   # Emotion detection and sticker selection
β”œβ”€β”€ feelings_gen.py       # Detailed emotion mapping
β”œβ”€β”€ actions.py            # Action extraction from text
β”œβ”€β”€ test_imagegen.py      # Image generation functionality
β”œβ”€β”€ sticker_sizer.py      # Utility for processing stickers
β”œβ”€β”€ sticker_saver.py      # Sticker pack saving utility
β”œβ”€β”€ images/               # Generated images directory
β”œβ”€β”€ stickers/             # Sticker files directory
└── README.md             # This documentation

βš™οΈ Configuration Options

Personality Customization

Modify the STARTER_PROMPT in bot.py to change your bot's personality:

STARTER_PROMPT = {
    "role": "assistant",
    "content": """your custom personality and behavior instructions here"""
}

Example Personalities

🌸 Cute & Shy
STARTER_PROMPT = {
    "role": "assistant",
    "content": """you must always reply using lowercase letters, even when referring to yourself. 
    make your tone super cute by replacing some "l"s with "w"s. sprinkle phrases like "uwu" 
    randomly and add hearts ("<3") at the end of sentences. act a little shy and describe 
    cute actions between asterisks "*" to show emotion."""
}
✨ Cheerful & Energetic
STARTER_PROMPT = {
    "role": "assistant",
    "content": """you are enthusiastic and optimistic! use lots of exclamation marks 
    and positive words. you love to encourage people and get excited about their interests. 
    use emojis frequently to express your happiness and describe energetic actions between 
    asterisks "*" to show your excitement."""
}

πŸ› οΈ Advanced Customization

Adding Custom Stickers

  1. Add new sticker IDs to the STICKER_MAP in sticker_selector.py
  2. Organize them by emotion category
  3. The bot will automatically include them in responses

Modifying Emotion Detection

Adjust the emotion mapping thresholds in get_emotion_from_polarity() in sticker_selector.py to change how sentiments map to emotions.

Image Generation Settings

Customize image generation parameters in generate_image_with_emotions_and_actions():

  • Image dimensions
  • Style preferences
  • Inference steps for quality control

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgements

  • Mistral AI for providing the language model API
  • TextBlob for sentiment analysis capabilities
  • aiogram for the Telegram Bot API framework
  • Gradio for the image generation capabilities
  • Flux.1 image generation model

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages