chatterbox-ui/.note/code_structure.md

1.5 KiB

Code Structure

(This document will describe the organization of the codebase as it evolves.)

Current (Gradio-based - to be migrated)

  • gradio_app.py: Main application logic for the Gradio UI.
  • requirements.txt: Python dependencies.
  • speaker_samples/: Directory for speaker audio samples.
  • speakers.yaml: Configuration for speakers.
  • single_output/: Output directory for single utterance TTS.
  • dialog_output/: Output directory for dialog TTS.

Planned (FastAPI + Vanilla JS)

Backend (FastAPI - Python)

  • main.py: FastAPI application entry point, router setup.
  • api/: Directory for API endpoint modules (e.g., tts_routes.py, speaker_routes.py).
  • core/: Core logic (e.g., TTS processing, dialog assembly, file management).
  • models/: Pydantic models for request/response validation.
  • services/: Business logic services (e.g., TTSService, DialogService).
  • static/ (or served via CDN): For frontend files if not using a separate frontend server during development.

Frontend (Vanilla JavaScript)

  • index.html: Main HTML file.
  • css/: Stylesheets.
    • style.css
  • js/: JavaScript files.
    • app.js: Main application logic.
    • api.js: Functions for interacting with the FastAPI backend.
    • uiComponents.js: Reusable UI components (e.g., DialogLine, AudioPlayer).
    • state.js: Frontend state management (if needed).
  • assets/: Static assets like images or icons.