- Add XTTS v2 configuration to .env.example - Refactor Dockerfile to multi-stage build with CUDA 12.1 support - Update Makefile with Kokoro and XTTS test environment targets - Refactor Piper engine (app/engines/piper.py) to use python module execution - Add comprehensive documentation for Kokoro and XTTS plans - Add helper scripts and patches for build process
2.9 KiB
2.9 KiB
Repository Guidelines
Project Structure & Module Organization
app/FastAPI service code:main.pyapp factory,engines/TTS backends (Piper, Kokoro, XTTS, F5, StyleTTS, ChatTTS),utils/helpers (text chunking, audio concat, cache keys),models/default model assets.app/asset/runtime assets and audio cache (overridable viaAUDIO_CACHE_DIR);asset/holds Docker/runtime assets mounted into the container.tests/pytest suite with async API coverage and fixtures that redirect cache paths.docs/reference material;scripts/helper scripts (health checks, setup);Dockerfile,docker-compose*.yml, andMakefiledrive builds and orchestration.
Build, Test, and Development Commands
make dev-upBuild from local source and start the stack; auto-picks a free host port.make upRun using the latest registry image;make downstops Compose services;make logstails the app container.make testRun pytest with coverage overapp/andtests/; honors.venvif present.- Local uvicorn run (outside Docker):
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000.
Coding Style & Naming Conventions
- Python code should follow PEP 8 with 4-space indentation and explicit type hints where meaningful; keep functions small and async-aware for I/O.
- Prefer FastAPI dependency injection patterns and pydantic models for request/response validation.
- Tests, fixtures, and helpers use
test_*.pynaming; keep fixtures intests/conftest.py. - Configuration lives in
app/config.pyvia pydantic settings; read values from.envinstead of hardcoding.
Testing Guidelines
- Use
pytest/pytest-asyncio; mark async tests with@pytest.mark.asyncio. - Ensure Piper models required by tests exist under
app/models/piper/(see README instructions) or skip conditionally as in existing tests. - When adding engines, supply health checks (
healthcheck), model/voice listing, and synthesis tests mirroringtests/test_api.py. - Keep coverage broad on
/tts,/engines,/models,/health, and error paths (invalid engine/model/speaker).
Commit & Pull Request Guidelines
- Follow the existing conventional prefix style (
feat:,fix:,docs:, etc.) as seen in git history. - Commits should be scoped and descriptive; avoid bundling unrelated changes.
- PRs should include: purpose and behavior summary, key test commands run (e.g.,
make test), notes on model/config prerequisites, and screenshots/log snippets only when behavior is user-visible.
Security & Configuration Tips
- Copy
.env.exampleto.envand avoid committing secrets or model paths tied to personal systems. - Validate engine activation lists via
ACTIVE_ENGINESand ensure cache directories (AUDIO_CACHE_DIR) are writable before running locally or in containers. - Large model files live outside the image; mount them via Compose volumes and confirm licenses (e.g., XTTS
XTTS_ACCEPT_LICENSE).