Skip to content

accurate pause#88

Closed
richardr1126 wants to merge 9 commits intomainfrom
accurate-pause
Closed

accurate pause#88
richardr1126 wants to merge 9 commits intomainfrom
accurate-pause

Conversation

@richardr1126
Copy link
Copy Markdown
Owner

  • feat: add support for Replicate TTS provider and models
  • feat(replicate): add support for custom Replicate model selection
  • feat(TTS): implement pause functionality with state preservation
  • refactor(tts): update Replicate model defaults and voice resolution
  • feat(TTS): implement pause functionality with state preservation
  • refactor(tts): centralize upstream response helpers and improve settings validation
  • feat(TTS): implement pause functionality with state preservation

- Updated environment variables documentation to include Replicate as a TTS provider option.
- Added Replicate to the sidebar for TTS provider guides.
- Included Replicate as a dependency in package.json and pnpm-lock.yaml.
- Enhanced audiobook chapter generation to normalize native speed settings based on the TTS provider.
- Improved error handling in TTS API routes to provide retry information for rate-limited responses.
- Updated AudiobookExportModal to reflect native speed support for Replicate models.
- Modified SettingsModal to set default model for Replicate.
- Enhanced SpeedControl component to conditionally render native speed controls based on provider support.
- Updated TTSContext to utilize effective native speed for TTS requests.
- Implemented Replicate request handling in the TTS generation logic.
- Added new documentation for configuring Replicate as a TTS provider.
Align default Replicate model to the versioned Kokoro model across UI, docs,
and server logic. Refactor TTS settings merging for audiobooks to ensure
consistent normalization. Improve Retry-After header handling for upstream
rate limits. Expand Replicate voice resolution to use model schemas when
available, with test coverage for custom and built-in models.

Update documentation to reflect new Replicate defaults, model selection,
and configuration guidance.
…ngs validation

Move getUpstreamStatus and getUpstreamRetryAfterSeconds to a shared utility
module for consistent upstream error handling across TTS endpoints. Strengthen
audiobook chapter API by introducing runtime validation for incoming settings
payloads, ensuring type safety and error reporting for malformed requests.
Replace in-memory Map caches with LRUMap for Replicate voice and schema
lookups, improving memory management and eviction logic.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
open-reader-web-ui Ready Ready Preview, Comment Apr 16, 2026 7:11pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

Warning

Rate limit exceeded

@richardr1126 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 42 minutes and 11 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 42 minutes and 11 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9d417020-8225-4277-a1a8-47af6766f3a1

📥 Commits

Reviewing files that changed from the base of the PR and between 6606b0e and 304d3d5.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (21)
  • README.md
  • docs-site/docs/configure/tts-provider-guides/replicate.md
  • docs-site/docs/configure/tts-providers.md
  • docs-site/docs/deploy/vercel-deployment.md
  • docs-site/docs/docker-quick-start.md
  • docs-site/docs/introduction.md
  • docs-site/docs/reference/environment-variables.md
  • docs-site/sidebars.ts
  • package.json
  • src/app/api/audiobook/chapter/route.ts
  • src/app/api/tts/route.ts
  • src/components/AudiobookExportModal.tsx
  • src/components/SettingsModal.tsx
  • src/components/player/SpeedControl.tsx
  • src/contexts/TTSContext.tsx
  • src/lib/server/tts/generate.ts
  • src/lib/server/tts/upstream-response.ts
  • src/lib/shared/kokoro.ts
  • src/lib/shared/tts-provider-catalog.ts
  • tests/unit/kokoro.spec.ts
  • tests/unit/tts-provider-catalog.spec.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch accurate-pause

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 304d3d51e0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +331 to +333
// Output is a URI string pointing to the generated audio file
const audioUrl = typeof output === 'string' ? output : String(output);
const audioResponse = await fetch(audioUrl, { signal });
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Handle non-string outputs from replicate.run

This assumes replicate.run() always returns a URL string, but Replicate models that output files can return FileOutput objects or arrays; in those cases String(output) becomes something like "[object Object]" or a comma-joined list, and fetch(audioUrl) fails even though the upstream generation succeeded. This will break audio generation for any Replicate model whose output is not a plain string URL, so the code should explicitly handle FileOutput/array outputs (or configure the client to return raw URLs).

Useful? React with 👍 / 👎.

Comment on lines +103 to +105
async function runWithReplicateGate<T>(signal: AbortSignal, operation: () => Promise<T>): Promise<T> {
const waitMs = Math.max(0, replicateBlockedUntilMs - Date.now());
if (waitMs > 0) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Scope Replicate cooldown by credential/model

The cooldown gate is process-global, so a single 429 from one request sets replicateBlockedUntilMs for every subsequent Replicate request in this worker, including different users and API keys. In a multi-user deployment where clients can send their own keys, one throttled key can unnecessarily stall unrelated traffic for up to the full Retry-After window; cooldown state should be partitioned (at least by API key, ideally by key+model).

Useful? React with 👍 / 👎.

Comment on lines +456 to +458
async function getReplicateOpenApiSchemaCached(apiKey: string, model: string): Promise<unknown | null> {
const cachedPromise = replicateOpenApiSchemaPromiseCache.get(model);
if (cachedPromise) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Key Replicate schema caches with API key context

Both schema and voice-input-key caches are indexed only by model, so schema data fetched with one token is reused for later requests with different tokens. For private/custom Replicate models, this can leak metadata (voices/input fields) across users and also produce incorrect voice-key resolution when different credentials see different schema versions; cache keys should include credential context (or avoid cross-request sharing for authenticated model metadata).

Useful? React with 👍 / 👎.

@richardr1126 richardr1126 deleted the accurate-pause branch April 16, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant