2025-12-22 02:05:52 +01:00
2025-12-22 02:05:52 +01:00
2025-12-22 02:24:26 +01:00

MyStar: Self-Hosted AI Companion

MyStar is an advanced, fully local AI companion bot for Telegram built with Python, Ollama, SD.Next, and Whisper.

Unlike simple chatbots, MyStar features a "living" personality with long-term memory, simulated biological cycles, multimodal perception (vision/hearing), and autonomous behavior.


🚀 Key Features

🧠 1. Dynamic Personality & Cognition

  • Modular Prompting: The SYSTEM_PROMPT is assembled dynamically on the fly. Depending on the context, different personality modules are injected into the base prompt.
  • Long-Term Memory (LTM): The bot utilizes a "Diary" system (SQLite). It does not simply feed the entire chat history to the LLM. Instead, it injects: [Base Persona] + [LTM Summary] + [Recent Context].
  • Background "Thinking": When you are inactive, a background process (run_memory_summarization) analyzes recent conversations, extracts key facts about you (hobbies, problems, plans), and saves them to the LTM database.

💖 2. Relationships & Biological States

  • Relationship Progression: The bot supports three distinct stages: Stranger, Friend, and Lover.
  • Auto-Progression: The bot automatically detects romantic intent and upgrades the relationship status.
  • Simulated 28-Day Cycle: The bot tracks a simulated cycle that affects her mood and prompt directives:
    • Period (Days 1-7): She may feel moody, crave comfort, and will refuse NSFW interactions.
    • Ovulation (Days 12-16): She becomes more flirtatious, confident, and affectionate.

👁️ 3. Multimodal Perception ("Sensors")

  • Vision (Image Recognition): You can send photos to the bot. She "sees" them and comments on them naturally.
  • Hearing (Voice Messages): Integrated OpenAI Whisper allows the bot to listen to your voice notes and respond to them as text.
  • Context Awareness: She detects your work schedule and respects your time (avoiding distractions during work hours).

💬 4. Advanced Interaction & Visuals

  • AI Spontaneous Messages: No hardcoded templates. If you haven't texted in a while, she generates a unique, context-aware message to check on you.
  • High-Quality Image Generation:
    • Powered by SD.Next and the AAM XL (Anime Mix) model for top-tier anime aesthetics.
    • SFW by Default: Generates cute/cozy selfies based on the conversation context.
    • Contextual NSFW: Explicit generation is strictly gated (requires 'Lover' status, specific user request, and appropriate timing).

🛠️ Tech Stack & Requirements

  • Python 3.10+
  • Ollama: Running locally (default LLM: gemma3:12b).
  • Image Generation Engine:
  • FFmpeg: Required for Whisper voice processing.

📦 Installation

  1. Clone the repository:

    git clone https://git.maxo.one/Maxo/MyStar.git
    cd MyStar
    
  2. Install dependencies:

    pip install python-telegram-bot python-telegram-bot[job-queue] openai-whisper requests
    
  3. Setup SD.Next:

    • Install SD.Next.
    • Download the AAM XL checkpoint and place it in the models/Stable-diffusion folder.
    • Launch SD.Next with API enabled: ./webui.sh --api (or .bat on Windows).
  4. Environment Setup: Set the following environment variable:

    export TELEGRAM_BOT_TOKEN="your_telegram_bot_token"
    # Optional:
    # export OLLAMA_NUM_GPU=63
    
  5. Run:

    python MyStarEN.py
    

📄 License

MIT License. See LICENSE file for details.

Description
AI Girlfriend
Readme MIT 121 KiB
Languages
Python 100%