Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Read an oversized clip to its end before the 413; name the app with {app}

aivsomkarb25efc58d2e7
diff --git a/server/routes/tts.ts b/server/routes/tts.ts
index 1ebf8d5457..964ca9c559 100644
--- a/server/routes/tts.ts
+++ b/server/routes/tts.ts
@@ -92,22 +92,12 @@ export function createTtsRoutes(deps: TtsRouteDeps): RouteHandler {
const audio = await new Promise<Buffer | null>((resolve, reject) => {
const chunks: Buffer[] = [];
let received = 0;
- let settled = false;
- // Past the cap the listeners stay attached and drop the rest, so the request drains.
+ // Answering before the upload is read to its end resets the connection on Windows instead of delivering the 413.
req.on("data", (chunk: Buffer) => {
- if (settled) return;
received += chunk.byteLength;
- if (received > TRANSCRIBE_MAX_BYTES) {
- settled = true;
- return resolve(null);
- }
- chunks.push(chunk);
- });
- req.on("end", () => {
- if (settled) return;
- settled = true;
- resolve(Buffer.concat(chunks));
+ if (received <= TRANSCRIBE_MAX_BYTES) chunks.push(chunk);
});
+ req.on("end", () => resolve(received > TRANSCRIBE_MAX_BYTES ? null : Buffer.concat(chunks)));
req.on("error", reject);
});
if (!audio) return json(res, 413, { error: `audio exceeds ${TRANSCRIBE_MAX_BYTES} bytes` });
diff --git a/src/locales/en.json b/src/locales/en.json
index 0992836310..dce64d80bb 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -6371,7 +6371,7 @@
"call.capability.turnsNeedFishKey": "Add a Fish Audio key to take turns on calls",
"call.capability.turnsNeedFishKeyReason": "On this computer, Take turns hears you through Fish Audio speech-to-text. Add a Fish Audio key in Settings → API keys.",
"call.capability.turnsNeedDesktop": "Calls where you take turns need the desktop app",
- "call.capability.turnsNeedDesktopReason": "They listen from this computer, so they need the MausBot app on a Mac, Windows or Linux computer.",
+ "call.capability.turnsNeedDesktopReason": "They listen from this computer, so they need {app} on a Mac, Windows or Linux computer.",
"call.capability.turnsOnThisComputerAnyOs": "Calls where you take turns work with bots on this computer",
"call.capability.turnsOnThisComputerAnyOsReason": "They listen from this computer's own window, so only bots on this computer can use them.",
"call.capability.turnsOnThisComputer": "Calls where you take turns work with bots on this Mac",