Skip to content

fix: resolve Google TTS 200-character limit video render crash#287

Merged
knoxiboy merged 2 commits into
knoxiboy:mainfrom
angelina-2206:fix/resolve-google-tts-limit
May 25, 2026
Merged

fix: resolve Google TTS 200-character limit video render crash#287
knoxiboy merged 2 commits into
knoxiboy:mainfrom
angelina-2206:fix/resolve-google-tts-limit

Conversation

@angelina-2206
Copy link
Copy Markdown
Contributor

Description

This PR resolves the 200-character limit crash in the Google Text-to-Speech API (google-tts-api@0.0.6) during video generation. Long narration texts generated by the AI are now split into word-aligned chunks under 200 characters, fetched separately, and stitched together using Buffer.concat to produce a single audio asset.

Additionally, this PR:

  1. Fixes a request body stream consumption crash in the /api/video/generate route by replacing the double req.json() call with the validated data object.
  2. Resolves syntax, duplicate declaration, and merge errors inherited from upstream/main in auth pages, doubts, and replies API routes to restore build compilation.

Related Issue

Closes #272

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update (README, guides, comments)
  • Style / UI change (no logic change)
  • Code refactor (no behavior change)
  • Test addition or update
  • Breaking change (fix or feature that would cause existing functionality to change)

How Has This Been Tested?

  • Tested locally with npm run dev (verified with npm run build and npm run test)

Checklist

  • I have tested my changes locally (npm run dev)
  • My code follows the existing code style (TypeScript, Tailwind, no any types)
  • I have not introduced unrelated changes (each PR should address one issue)
  • I have added comments where necessary
  • My branch is up to date with main
  • I have linked the related issue above

@vercel
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

@angelina-2206 is attempting to deploy a commit to the Karan Mani Tripathi 's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc'26 GSSoC program issue level:advanced Advanced level task type:bug Bug fix labels May 24, 2026
@github-actions github-actions Bot requested a review from knoxiboy May 24, 2026 15:20
Copy link
Copy Markdown
Owner

@knoxiboy knoxiboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review: Thank you for starring the repository! The PR is approved.
Note: This PR currently has merge conflicts with the main branch. Please resolve the merge conflicts so we can complete the merge!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses the video generation crash caused by Google TTS text-length limits and also cleans up several API/auth compilation issues.

Changes:

  • Replaces direct google-tts-api usage with chunked Google TTS URL generation and audio buffer concatenation.
  • Uses validated request data in video generation instead of reading the request body twice.
  • Removes broken duplicate auth page code and fixes small API route typing/destructuring issues.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
app/api/video/generate/route.ts Adds TTS chunking/audio stitching and fixes request body reuse.
app/api/replies/vote/route.ts Removes duplicate body parsing after validation.
app/api/replies/route.ts Uses validated numeric doubtId directly.
app/api/replies/action/[id]/route.ts Removes unused destructured fields from validated data.
app/api/doubts/route.ts Adds explicit array typing for reassigned doubt results.
app/(auth)/sign-up/[[...sign-up]]/page.tsx Removes duplicated malformed component code and restores themed sign-up page.
app/(auth)/sign-in/[[...sign-in]]/page.tsx Removes duplicated malformed component code and restores themed sign-in page.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +24 to +28
if ((currentChunk + " " + word).trim().length > maxLen) {
if (currentChunk.trim().length > 0) {
chunks.push(currentChunk.trim());
}
currentChunk = word;
@knoxiboy
Copy link
Copy Markdown
Owner

Hi there! 👋 Thanks for your contribution to DoubtDesk.

It looks like there are currently some merge conflicts between your branch and the main branch. Could you please pull the latest changes from main, resolve the conflicts, and push the updates to this branch?

Once the conflicts are resolved and the PR is clean, we'll be able to merge it!

@knoxiboy knoxiboy merged commit fa943ff into knoxiboy:main May 25, 2026
3 of 4 checks passed
@github-actions github-actions Bot added gssoc:approved Approved for GSSoC mentor:knoxiboy Reviewed by mentor knoxiboy quality:clean Clean code quality and removed size/m labels May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Approved for GSSoC gssoc'26 GSSoC program issue level:advanced Advanced level task mentor:knoxiboy Reviewed by mentor knoxiboy quality:clean Clean code quality type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: [CRITICAL] Google TTS 200-character limit causes video generation crash

3 participants