chore: simplify project entrypoints
This commit is contained in:
29
AGENTS.md
29
AGENTS.md
@@ -18,6 +18,11 @@ DreamWeaver (梦语织机) - AI-powered children's story generation app for ages
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
# Docker demo stack
|
||||
cp backend/.env.example backend/.env
|
||||
docker compose up -d --build
|
||||
docker compose ps
|
||||
|
||||
# Backend
|
||||
cd backend
|
||||
pip install -e . # Install dependencies
|
||||
@@ -25,7 +30,8 @@ pip install -e ".[dev]" # With dev tools (pytest, ruff)
|
||||
uvicorn app.main:app --reload --port 8000 # Start dev server
|
||||
|
||||
# Celery worker (requires Redis)
|
||||
celery -A app.tasks worker --loglevel=info
|
||||
celery -A app.core.celery_app worker --loglevel=info
|
||||
celery -A app.core.celery_app beat --loglevel=info
|
||||
|
||||
# Database migrations
|
||||
alembic upgrade head # Run migrations
|
||||
@@ -45,6 +51,12 @@ cd frontend
|
||||
npm install
|
||||
npm run dev # Start dev server (port 5173)
|
||||
npm run build # Type-check + build
|
||||
|
||||
# Admin frontend
|
||||
cd admin-frontend
|
||||
npm install
|
||||
npm run dev
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Architecture
|
||||
@@ -97,11 +109,12 @@ frontend/src/
|
||||
- **JWT auth:** Stored in httpOnly cookie, validated via `get_current_user` dependency
|
||||
- **Provider routing:** `provider_router.py` tries providers in order, auto-failover on error
|
||||
- **Background tasks:** Celery workers handle achievements and push notifications
|
||||
- **Proxy in dev:** Vite proxies `/api`, `/auth`, `/admin` to backend (see `vite.config.ts`)
|
||||
- **Docker proxy:** Frontend Nginx proxies `/api`, `/auth`, `/admin`, `/static` to backend services
|
||||
- **Local demo:** `ENABLE_DEMO_PROVIDERS=true` enables deterministic text/image/storybook demo adapters
|
||||
|
||||
## Provider System
|
||||
|
||||
AI providers are configured via env vars (`TEXT_PROVIDERS`, `IMAGE_PROVIDERS`, `TTS_PROVIDERS`) as JSON arrays. The router tries each in order and fails over automatically.
|
||||
AI providers are configured via env vars (`TEXT_PROVIDERS`, `IMAGE_PROVIDERS`, `TTS_PROVIDERS`, `STORYBOOK_PROVIDERS`) as JSON arrays. The router tries each in order and fails over automatically.
|
||||
|
||||
Admin console (disabled by default): Set `ENABLE_ADMIN_CONSOLE=true` to enable `/admin/providers` CRUD endpoints with Basic Auth (`ADMIN_USERNAME`/`ADMIN_PASSWORD`).
|
||||
|
||||
@@ -112,7 +125,8 @@ See `backend/.env.example` for required variables:
|
||||
- `DATABASE_URL`, `SECRET_KEY` (required)
|
||||
- OAuth: `GITHUB_CLIENT_ID/SECRET`, `GOOGLE_CLIENT_ID/SECRET`
|
||||
- AI: `TEXT_API_KEY`, `TTS_API_BASE`, `TTS_API_KEY`, `IMAGE_API_KEY`
|
||||
- Providers: `TEXT_PROVIDERS`, `IMAGE_PROVIDERS`, `TTS_PROVIDERS` (JSON arrays)
|
||||
- Providers: `TEXT_PROVIDERS`, `IMAGE_PROVIDERS`, `TTS_PROVIDERS`, `STORYBOOK_PROVIDERS` (JSON arrays)
|
||||
- Demo mode: `ENABLE_DEMO_PROVIDERS`
|
||||
- Celery: `CELERY_BROKER_URL`, `CELERY_RESULT_BACKEND` (Redis URLs)
|
||||
- Admin: `ENABLE_ADMIN_CONSOLE`, `ADMIN_USERNAME`, `ADMIN_PASSWORD`
|
||||
|
||||
@@ -121,10 +135,11 @@ See `backend/.env.example` for required variables:
|
||||
| Method | Route | Description |
|
||||
| ------------------- | -------------------------- | --------------------------- |
|
||||
| GET | `/auth/{provider}/signin` | OAuth login |
|
||||
| GET | `/auth/dev/signin` | Local dev login |
|
||||
| GET | `/auth/session` | Get current user |
|
||||
| POST | `/api/generate` | Generate/enhance story |
|
||||
| POST | `/api/image/generate/{id}` | Generate cover image |
|
||||
| GET | `/api/audio/{id}` | Get TTS audio |
|
||||
| POST | `/api/stories/generate/full` | Generate story + assets |
|
||||
| POST | `/api/storybook/generate` | Generate storybook |
|
||||
| POST | `/api/stories/{id}/assets/retry` | Retry cover/audio assets |
|
||||
| GET | `/api/stories` | List stories (paginated) |
|
||||
| GET/DELETE | `/api/stories/{id}` | Story CRUD |
|
||||
| CRUD | `/api/profiles` | User profiles |
|
||||
|
||||
Reference in New Issue
Block a user