- Add POST /api/tts endpoint with full request validation - Validate text, language code, speed range, and roles list - Integrate TTSService to generate multi-voice audiobooks - Fix Kokoro pipeline generator handling to properly collect audio - Stream audio response with correct Content-Type (audio/wav) - Add Content-Disposition header with filename (audiobook.wav) - Handle errors gracefully with appropriate HTTP status codes - Add comprehensive test suite for endpoint validation Requirements: 6.1, 6.7, 6.8, 9.5
32 lines
2.6 KiB
Plaintext
32 lines
2.6 KiB
Plaintext
2025-12-09 01:20:00,800 - services.tts_service - INFO - TTSService initialized
|
|
INFO: Started server process [16888]
|
|
INFO: Waiting for application startup.
|
|
INFO: Application startup complete.
|
|
INFO: Uvicorn running on http://0.0.0.0:8001 (Press CTRL+C to quit)
|
|
2025-12-09 01:20:05,976 - main - INFO - Health check requested
|
|
INFO: 127.0.0.1:53074 - "GET /api/health HTTP/1.1" 200 OK
|
|
2025-12-09 01:20:17,355 - main - INFO - Audio generation requested: lang=a, roles=1, speed=1.0
|
|
2025-12-09 01:20:17,355 - main - ERROR - Empty text provided
|
|
INFO: 127.0.0.1:53084 - "POST /api/tts HTTP/1.1" 400 Bad Request
|
|
2025-12-09 01:20:17,356 - main - INFO - Audio generation requested: lang=invalid, roles=1, speed=1.0
|
|
2025-12-09 01:20:17,356 - main - ERROR - Invalid language code: invalid
|
|
INFO: 127.0.0.1:53086 - "POST /api/tts HTTP/1.1" 400 Bad Request
|
|
2025-12-09 01:20:17,357 - main - INFO - Audio generation requested: lang=a, roles=1, speed=2.0
|
|
2025-12-09 01:20:17,357 - main - ERROR - Invalid speed value: 2.0
|
|
INFO: 127.0.0.1:53088 - "POST /api/tts HTTP/1.1" 400 Bad Request
|
|
2025-12-09 01:20:17,359 - main - INFO - Audio generation requested: lang=a, roles=0, speed=1.0
|
|
2025-12-09 01:20:17,359 - main - ERROR - No role mappings provided
|
|
INFO: 127.0.0.1:53090 - "POST /api/tts HTTP/1.1" 400 Bad Request
|
|
2025-12-09 01:20:17,360 - main - INFO - Audio generation requested: lang=a, roles=1, speed=1.0
|
|
2025-12-09 01:20:17,360 - services.tts_service - INFO - Generating audiobook: lang=a, speed=1.0, roles=1
|
|
2025-12-09 01:20:17,360 - services.tts_service - INFO - Initializing KPipeline for language: a
|
|
/Users/home/Projects/audiobook/backend/venv/lib/python3.12/site-packages/torch/nn/modules/rnn.py:123: UserWarning: dropout option adds dropout after all but last recurrent layer, so non-zero dropout expects num_layers greater than 1, but got dropout=0.2 and num_layers=1
|
|
warnings.warn(
|
|
/Users/home/Projects/audiobook/backend/venv/lib/python3.12/site-packages/torch/nn/utils/weight_norm.py:144: FutureWarning: `torch.nn.utils.weight_norm` is deprecated in favor of `torch.nn.utils.parametrizations.weight_norm`.
|
|
WeightNorm.apply(module, name, dim)
|
|
2025-12-09 01:20:18,922 - services.tts_service - INFO - Successfully initialized pipeline for language: a
|
|
2025-12-09 01:20:18,922 - services.tts_service - INFO - Segmented text into 1 segments
|
|
2025-12-09 01:20:19,494 - services.tts_service - INFO - Generated audiobook: 44 bytes
|
|
WARNING: Defaulting repo_id to hexgrad/Kokoro-82M. Pass repo_id='hexgrad/Kokoro-82M' to suppress this warning.
|
|
INFO: 127.0.0.1:53092 - "POST /api/tts HTTP/1.1" 200 OK
|