# AutoMixSJ88Free

## Active Target (Only)
This repository deploys to one target only:

- Domain: `https://free1.sj88ai.com`
- Origin IP: `5.83.147.61`
- App path: `/opt/automixsj88-free1`
- Web service: `automixsj88-free1.service`
- Worker service: `automixsj88-free1-worker.service`
- Nginx site: `/etc/nginx/sites-available/free1.sj88ai.com`

Do not deploy this repository to any other host/domain unless explicitly changed in this file.

## Runtime
- Node.js + Express
- MariaDB/MySQL
- Nginx reverse proxy
- Let's Encrypt certificate for `free1.sj88ai.com`
- Public ads runtime can be toggled by `PUBLIC_ADS_ENABLED` (`0` = off, `1` = on)

## TTS Runtime Default
- Provider: Gemini API
- Default model: `gemini-3.1-flash-tts-preview`
- Fallback chain: `gemini-3.1-flash-tts-preview` -> `gemini-2.5-flash-preview-tts` -> `gemini-2.5-pro-preview-tts`
- `generate-scripts` supports 3.1 `Auto Emotion` mode (toggle + level 1..5) with `Emotion Diversity` strict mode by default
- 3.1 auto-emotion now applies anti-repeat memory (`20` recent accepted patterns per user+project+mode) and retries on emotion pattern repeats
- Details: `docs/runtime_tts_3_1.md`

## Global Key Policy (Free Runtime)
- Key routing: `user key > global key` only
- Runtime no longer uses env key fallback (`GEMINI_API_KEY`, `GEMINI_API_KEYS`) for Gemini key candidate rotation
- Admin can replace all global keys in one request: `POST /api/admin/keys` with `action=replace_global`
- Startup seed (DB empty only): configure `GLOBAL_GEMINI_KEYS_SEED` (+ optional `GLOBAL_GEMINI_KEYS_SEED_ENABLED=1`)

## Health Check
- Public: `https://free1.sj88ai.com/api/health`
- Local origin: `http://127.0.0.1:20003/api/health`

## Local Run
```bash
npm install
copy .env.example .env
npm run start:web
```

## Documentation
- Canonical docs index: `docs/README.md`
- Search portal: `docs/index.html`
- Runtime TTS details: `docs/runtime_tts_3_1.md`
- Admin Insights Graph Pack: `docs/admin_insights_graph_pack.md`
- Release history: `CHANGELOG.md`
