Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Waifu

A tsundere AI companion powered by the Gemini API. She remembers your conversations, reacts emotionally, and never admits she cares.

Features

  • Emotion system — affection and mood shift based on what you say
  • Memory — keeps track of the last 20 messages for context
  • Gemini backend — powered by Google AI Studio (free tier)
  • REST API — built with FastAPI

Project Structure

ai_waifu/
├── app/
│   ├── main.py           # FastAPI app and routes
│   ├── core/
│   │   ├── llm.py        # Gemini API integration
│   │   ├── emotion.py    # Emotion state logic
│   │   ├── memory.py     # Conversation memory
│   │   └── prompt.py     # Prompt builder
│   └── models/
│       └── shema.py      # Request schemas
├── config.py             # Centralized config (API key, model name)
├── requirements.txt
└── .env.example

Getting Started

Prerequisites

Installation

# Clone the repo
git clone <repo-url>
cd ai_waifu

# Create and activate virtual environment
python -m venv .venv
.venv\Scripts\activate      # Windows
source .venv/bin/activate   # macOS / Linux

# Install dependencies
pip install -r requirements.txt

Configuration

cp .env.example .env

Edit .env and fill in your API key:

GEMINI_API_KEY=your_api_key_here

config.py

config.py centralizes all app settings. You can change the model here without touching any other files:

class Config:
    GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
    MODEL_NAME = "gemini-3.1-flash-lite"  # Change this to switch models

Run

uvicorn app.main:app --reload

API is available at http://127.0.0.1:8000
Interactive docs at http://127.0.0.1:8000/docs

API

POST /chat

Send a message and get a response from Aki.

Request

{
  "message": "你好"
}

Response

{
  "reply": "……你突然說這個幹嘛。",
  "emotion": {
    "affection": 50,
    "mood": "neutral"
  }
}

About

A tsundere AI companion powered by the Gemini API. She remembers your conversations, reacts emotionally, and never admits she cares.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages