Add stream=true immediate audio mode for GET /tts#642
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a query-friendly ChangesTTS Query Endpoint with Streaming Refactor
Sequence Diagram(s)sequenceDiagram
participant Client
participant TTS_Get
participant Resolve
participant SpeakFlow
participant StreamGen
participant History
participant Storage
Client->>TTS_Get: GET /tts?text=...&stream=true|wait=true&response=...
TTS_Get->>Resolve: determine engine/profile/personality
alt stream=true
TTS_Get->>StreamGen: stream_speech(...)
StreamGen-->>Client: StreamingResponse audio/wav
else not stream
TTS_Get->>SpeakFlow: create generation (background)
SpeakFlow-->>TTS_Get: generation id / status URLs
TTS_Get-->>Client: 202 JSON (status/audio links)
alt wait=true
TTS_Get->>History: poll history.get_generation(id) (poll_ms)
History-->>TTS_Get: completed | failed | missing
alt completed && response=redirect
TTS_Get-->>Client: 307 redirect to audio URL
else completed && response=stream
TTS_Get->>Storage: get_audio(...)
Storage-->>TTS_Get: audio bytes
TTS_Get-->>Client: audio bytes
else failed
TTS_Get-->>Client: 500 JSON
end
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@backend/routes/generations.py`:
- Around line 388-389: Several except blocks catch ValueError and re-raise
HTTPException without chaining; update each "except ValueError as e:" block that
currently does "raise HTTPException(status_code=400, detail=str(e))" to use
exception chaining by adding "from e" (i.e., "raise
HTTPException(status_code=400, detail=str(e)) from e"). Locate all such handlers
(the except ValueError blocks and the corresponding raise HTTPException calls)
and apply the change so the original traceback is preserved.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b15030b9-56db-4b97-aae6-5e48e38ece3c
📒 Files selected for processing (3)
backend/README.mdbackend/routes/generations.pybackend/routes/speak.py
|
Follow-up with corrected formatting: Addressed the CodeRabbit exception-chaining feedback in commit 59ac71d. Updated all ValueError-to-HTTPException(400) mappings in backend/routes/generations.py to use raise ... from e at the four reported locations. Validation run:
|
Summary
What changed
Testing
Breaking changes
Checklist
AI Assistance Disclosure
This contribution was developed with assistance from GitHub Copilot (GPT-5.3-Codex). The contributor reviewed, tested, and approved all final code and documentation changes.
Summary by CodeRabbit
New Features
Improvements
Documentation