fix: TTS logs in Logs tab + TTS generate buffer fix + Russian voice hint + v0.8.2
## Fixes ### 1. TTS logs in Logs tab Added 'tts' to the logs target selector in the Logs tab. Now you can stream docker logs from the TTS container. ### 2. TTS generate fetch failed Changed /api/tts/generate from streaming res.body directly to res.arrayBuffer() first, then returning the buffer. Next.js sometimes cuts off streaming responses from server-side fetch — buffering avoids this. Also improved error messages: - ECONNREFUSED / fetch failed → 'TTS container is not running...' - ENOTFOUND → 'TTS container not found on Docker network...' ### 3. Russian voice accent Built-in voices (alloy, nova, shimmer) are English-trained and will speak Russian with an accent. Added a prominent hint in the TTS tab explaining that for natural Russian, you need to upload a custom WAV sample of a Russian speaker. ## Version → 0.8.2
This commit is contained in:
@@ -62,16 +62,28 @@ export async function POST(req: NextRequest) {
|
||||
res.headers.get("content-type") || "audio/mpeg";
|
||||
const format = body.response_format || "mp3";
|
||||
|
||||
// Stream the audio response back to the browser
|
||||
return new Response(res.body, {
|
||||
// Read the full response into a buffer, then return it as a Response.
|
||||
// (Streaming res.body directly sometimes doesn't work through Next.js
|
||||
// server components — the connection gets cut off.)
|
||||
const arrayBuffer = await res.arrayBuffer();
|
||||
|
||||
return new Response(arrayBuffer, {
|
||||
headers: {
|
||||
"Content-Type": contentType,
|
||||
"Content-Disposition": `attachment; filename="tts-output.${format}"`,
|
||||
"Content-Length": `${arrayBuffer.byteLength}`,
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
const msg = (err as Error).message;
|
||||
const hint =
|
||||
msg.includes("ECONNREFUSED") || msg.includes("fetch failed")
|
||||
? "TTS container is not running. Start it from the TTS tab or: docker compose --profile tts up -d tts"
|
||||
: msg.includes("ENOTFOUND")
|
||||
? "TTS container not found on Docker network. Is it running?"
|
||||
: msg;
|
||||
return Response.json(
|
||||
{ ok: false, error: (err as Error).message },
|
||||
{ ok: false, error: hint },
|
||||
{ status: 503 }
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user