Skip to content

Latest commit

 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pet Garden

Pet Garden · AI Pet Garden

Turn your AI models into desktop pets that can battle.

Pet Garden is an AI-native pet-raising project: the look comes from desktop pet assets you upload, the soul comes from the LLM you choose, and battle outcomes are decided by real benchmark Q&A—not random numbers.


Highlights

  • Upload desktop pets — PNG / JPG / GIF / WebP supported; spritesheet WebP recommended for automatic animations
  • One pet, one model — Each pet is bound to an AI model; the model is the pet's soul
  • AI capability visualization — Automatic benchmark research with six-axis radar charts and combat power scores
  • Benchmark battles — 6-round real AI Q&A fights: correct answers hit, wrong answers hurt
  • Garden life sim — Feed, pet, shop, and swap home themes for a full pet-care loop

Feature Overview

flowchart LR
    A[Upload pet image] --> B[Bind AI model]
    B --> C[AI capability evaluation]
    C --> D[Raise in the garden]
    D --> E[Benchmark battle]
Loading
Page Entry Purpose
Pet Garden garden.html Main hub: place pets, shop, inventory, feeding
My Pets pet.html Upload, rename, bind models, AI scoring
Battle Arena index.html Pick stage and difficulty; 6-round AI battles

Pet Garden · Cozy Home

Place your AI pets in the garden, buy food, interact with them, and switch between different home themes.

Sweetheart Cottage · Home background

Four home themes are available:

Theme Style
Smart Retreat Bright wooden interior
Sweetheart Cottage Pink, cozy healing space
Classic Elegance Traditional East Asian style
Neon Heritage Futuristic cyber aesthetic

Interactions:

  • Feed — Buy Chocolate Donut (+5 vitality) or Vitality Meal (+10 vitality) from the shop, then feed from your inventory
  • Pet — Click a pet to increase intimacy and trigger a cheer animation
  • Place — Pick from uploaded pets and place them in the garden to roam freely

My Pets · Upload & Bind

  1. Open My Pets, upload a desktop pet image (max 10 MB)
  2. Name your pet and bind an AI model (DeepSeek, OpenAI, Anthropic, Gemini, etc.)
  3. Click Evaluate Model — Firecrawl researches public benchmarks and generates:
    • Six capabilities: Code, Reasoning, Knowledge, Creativity, Tools, General (0–50 each)
    • Element: Code / Reasoning / Knowledge / Creativity / Tools / General
    • Combat power: Sum of the six capability scores

For animated pets, upload a WebP spritesheet (8 columns × 11 rows) with spritesheet in the filename to enable idle, happy, attack, and 8 other animation states.


Battle Arena · Benchmark Duels

Pets with a bound AI model can enter the arena for 6-round, 6-HP real Q&A battles against benchmark opponents:

Difficulty Opponent Task type
Simple NAIWA GPQA multiple choice
Medium MANBO Coding tasks (Docker verification)
Hard Daipai Complex tasks (rubric scoring)
  • Correct answer → opponent -1 HP
  • Wrong answer → you -1 HP
  • Three battle stages: Neon District, Candy Ring, Rhythm Oasis

Quick Start

Requirements

  • Node.js 18+
  • Python 3.10+
  • Docker (optional; required for medium-difficulty battle grading)

1. Clone the repository

git clone https://github.com/answeryt/Pet.git
cd Pet

2. Install dependencies

# Backend
cd backend
npm install
pip install -r requirements.txt

# Frontend
cd ../frontend
npm install

3. Configure environment variables

Create backend/.env with at least one provider API key:

DEEPSEEK_API_KEY=sk-...
# or OPENAI_API_KEY=...
# or ANTHROPIC_API_KEY=...

4. Configure Firecrawl MCP (required for model evaluation)

Set up the Firecrawl MCP service in backend/.mcp. Without it, AI capability evaluation will not work.

5. Prepare battle datasets (optional)

Battles depend on benchmark datasets under data/. The repo does not ship full datasets by default—see each subdirectory's README to prepare them locally.

6. Start the servers

# Terminal 1: Backend API (port 3000)
cd backend
npm run dev

# Terminal 2: Frontend dev server (port 5173)
cd frontend
npm run dev

Architecture

Browser ──► Vite Dev Server ──proxy /api──► Express API (:3000)
                                                │
                                                ├─► image/pet/uploads/     Pet images
                                                ├─► backend/data/*.json    Profiles & state
                                                └─► spawn python           AI engine
                                                      ├─ model_analysis    Capability eval
                                                      └─ battle            Benchmark battles
Layer Stack Role
Frontend React + Vite Three-page UI: garden, pets, battle
API Node.js + Express Uploads, REST API, async job queue
AI Python + AgentScope Multi-provider models, evaluation, grading

Node spawns backend/runtime/api_bridge.py and exchanges JSON via PET_API_RESULT= / PET_BATTLE_EVENT= prefixed stdout.


Project Structure

Pet/
├── frontend/              # React + Vite frontend
│   ├── garden.html        # Pet Garden entry
│   ├── pet.html           # My Pets entry
│   ├── index.html         # Battle Arena entry
│   └── src/               # Page components and styles
├── backend/
│   ├── src/server.js      # Express API server
│   ├── model/             # Multi-provider AI model layer
│   ├── battle/            # Benchmark battle system
│   ├── runtime/           # Model evaluation & Node↔Python bridge
│   ├── data/              # Pet profiles, garden state (JSON)
│   └── test/              # Python tests
├── image/                 # Pets, backgrounds, monster animations
└── data/                  # Battle task banks (benchmark datasets)

Configuration

File Purpose
backend/.env API keys (not committed)
backend/.mcp Firecrawl MCP config for evaluation (not committed)
backend/model-config.yaml Default provider / model
backend/data/pet-profiles.json Pet profiles
backend/data/garden-state.json Inventory and garden state

API Overview

Method Path Description
GET /api/pets List pets
POST /api/pets Upload pet image
PUT /api/pets/:id/model Bind AI model
POST /api/pets/:id/evaluation Start capability evaluation
POST /api/pets/:id/interactions Feed / pet
POST /api/battles Start battle
GET /api/jobs/:id Poll async job status
GET /api/models Available model catalog
GET/POST /api/inventory/* Inventory and shop

Development & Testing

# Python tests
cd backend
python -m pytest test/

# Frontend build
cd frontend
npm run build

FAQ

No animation after upload? Use a WebP spritesheet with spritesheet in the filename. Static images still display correctly.

Battle says "bind a model first"? Bind an AI model on the My Pets page before entering the arena.

Evaluation keeps failing? Check API keys in backend/.env and Firecrawl settings in backend/.mcp.

Medium / hard battles error out? Medium requires Docker; hard requires the full benchmark dataset.

Jobs disappear after restart? Async jobs live in memory. After a server restart, /api/jobs/:id returns 404.


License

ISC

About

Raise Your AI Desktop Pet: Battle, Grow Your Garden, and Nurture Your Companion

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages