# Wakelai Voice AI SaaS Platform

A multi-tenant voice AI platform built on OpenVoiceUI with Iron Man JARVIS-inspired 3D holographic interface.

## Features

- **Voice Control**: Natural voice interaction with live transcription
- **Live Canvas**: AI renders real HTML pages in real-time
- **Google Integration**: Calendar and Gmail voice commands
- **3D Holographic UI**: JARVIS-inspired interface using Three.js
- **Multi-Tenant**: Each customer gets isolated instances
- **Self-Hosted**: Your data stays on your hardware

## Tech Stack

- **Backend**: Flask (Python 3.12)
- **Database**: PostgreSQL 13
- **Cache**: Redis 7
- **Voice Engine**: OpenVoiceUI
- **3D UI**: Three.js (WebGL)
- **Deployment**: Docker, Nginx

## Quick Start

### Prerequisites

- Python 3.12+
- PostgreSQL 13+
- Redis 7+
- Docker (optional, for OpenVoiceUI)
- Node.js 20+ (for OpenVoiceUI npm setup)

### Installation

1. Clone the repository:
```bash
cd /home/ashraffarid2010/wakelai.com
```

2. Run the setup script:
```bash
bash scripts/setup.sh
```

3. Configure environment variables:
```bash
cp .env.example .env
# Edit .env with your API keys
```

4. Create database:
```bash
sudo -u postgres psql -c "CREATE DATABASE wakelai;"
psql -U postgres -d wakelai -f migrations/001_init.sql
```

5. Create admin user:
```bash
python run.py create-admin
```

6. Start the server:
```bash
python run.py
```

The platform will be available at http://localhost:4000

## Docker Deployment

### Development

```bash
docker-compose -f docker-compose.wakelai.yml up -d
```

### Production

```bash
docker-compose -f docker-compose.wakelai.yml --profile production up -d
```

## Configuration

Key environment variables in `.env`:

- `SECRET_KEY`: Flask secret key
- `DATABASE_URL`: PostgreSQL connection string
- `REDIS_URL`: Redis connection string
- `GOOGLE_CLIENT_ID`: Google OAuth client ID
- `GOOGLE_CLIENT_SECRET`: Google OAuth client secret
- `ANTHROPIC_API_KEY`: Claude API key
- `CLAWDBOT_AUTH_TOKEN`: OpenClaw authentication token

## Instance Management

Each user can create multiple voice AI instances. Instances can be:

- **Started/Stopped**: Control resource usage
- **Customized**: Different personas, voices, LLM providers
- **Integrated**: Google Calendar, Gmail
- **Styled**: 3D UI toggle, canvas rendering

## Google Integration Setup

1. Create Google Cloud project
2. Enable OAuth consent screen
3. Create OAuth 2.0 credentials
4. Add authorized redirect URIs:
   - `https://wakelai.com/auth/google/callback`
   - `https://wakelai.com/auth/google/instance-callback`

5. Enable APIs:
   - Google Calendar API
   - Gmail API

6. Add credentials to `.env`

## Architecture

```
┌─────────────────────────────────────────────────────────────┐
│                    SaaS Platform (wakelai.com)              │
├─────────────────────────────────────────────────────────────┤
│  Main Dashboard (Flask)    │  Voice Instances (OpenVoiceUI) │
│  - User management         │  - Per-tenant isolated         │
│  - Billing/subscription     │  - Voice canvas interface      │
│  - Instance provisioning   │  - Google integration          │
└─────────────────────────────────────────────────────────────┘
│                              │                              │
│  PostgreSQL                 │  3D UI Layer                  │
│  - Tenant isolation         │  - Three.js WebGL              │
│  - User data                │  - Holographic effects         │
└─────────────────────────────────────────────────────────────┘
```

## Security

- Multi-tenant data isolation
- Rate limiting on all endpoints
- CSRF protection on forms
- Secure session cookies
- Google OAuth 2.0
- Encrypted tokens at rest (in production)

## Monitoring

- Health check endpoint: `/health`
- Platform stats: `/api/stats`
- Instance health: `/instances/:id/health`

## License

MIT License

## Acknowledgments

- [OpenVoiceUI](https://github.com/MCERQUA/OpenVoiceUI) - Voice AI platform
- [Jarvis AI](https://github.com/eadmin2/jarvis_ai) - UI inspiration
- [Three.js](https://threejs.org/) - 3D rendering
- [Flask](https://flask.palletsprojects.com/) - Web framework
