Add Gandr as a provider to the Text-to-Speech block - #7282
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryAdds Gandr as a selectable text-to-speech provider using the existing unified TTS execution and audio-storage pipeline.
Confidence Score: 4/5The PR appears safe to merge, with only a non-blocking documentation-style inconsistency in the new Gandr parameter type. The Gandr provider is wired through the established validation, execution, provider-client, and storage layers; the remaining accepted concern is limited to declaration comments that should use TSDoc. Files Needing Attention: apps/sim/tools/tts/types.ts
|
| Filename | Overview |
|---|---|
| apps/sim/blocks/blocks/tts.ts | Adds Gandr provider selection, voice and format controls, tool routing, and parameter materialization consistently with sibling providers. |
| apps/sim/lib/internal/tts/client.ts | Adds the fixed-endpoint Gandr synthesis request, character-limit validation, shared response limits, and audio metadata mapping. |
| apps/sim/lib/internal/tts/execute-tool.ts | Adds Gandr input validation and dispatch to the unified TTS operation. |
| apps/sim/lib/internal/tts/operations.ts | Connects Gandr synthesis to the existing unified audio-storage path. |
| apps/sim/tools/tts/gandr.ts | Declares the Gandr internal tool, safe API-key visibility, defaults, projected model input, and standard outputs. |
| apps/sim/tools/tts/types.ts | Adds Gandr provider and parameter types correctly, but declaration documentation does not follow the required TSDoc convention. |
| apps/sim/tools/tts/operations.test.ts | Extends declaration and default-input coverage to the Gandr tool. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
B[TTS block: Gandr selected] --> T[tts_gandr tool]
T --> V[Validate voice and format]
V --> O[executeGandrTts]
O --> C[synthesizeGandr]
C --> G[Gandr speech API]
G --> S[Shared audio storage]
S --> R[TTS response with audio URL and file]
Reviews (1): Last reviewed commit: "Add Gandr as a provider to the Text-to-S..." | Re-trigger Greptile
| // Gandr TTS Types | ||
| export interface GandrTtsParams { | ||
| text: string // up to 2000 characters per request |
There was a problem hiding this comment.
The exported GandrTtsParams declaration and its text constraint use line comments instead of the required TSDoc form, preventing TSDoc-aware tooling from consuming this public parameter documentation consistently.
| // Gandr TTS Types | |
| export interface GandrTtsParams { | |
| text: string // up to 2000 characters per request | |
| /** Gandr TTS parameters. */ | |
| export interface GandrTtsParams { | |
| /** Text to synthesize, up to 2000 characters per request. */ | |
| text: string |
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
This adds Gandr as an eighth provider to the existing Text-to-Speech block, next to OpenAI, Deepgram, ElevenLabs, Cartesia, Google Cloud, Azure, and PlayHT. It follows the same pattern as the other providers at every layer, closest to the OpenAI one since Gandr's speech endpoint is OpenAI compatible.
What changed:
apps/sim/tools/tts/gandr.ts(new):gandrTtsToolwith idtts_gandr, mirroringopenai.ts. Params aretext,apiKey,voice(defaultgandr-mia), andresponseFormat(defaultmp3). Sameoperation.modelInputprojection,operation.inputmaterialization,transformResponse, andoutputsshape as the other unified TTS tools.apps/sim/tools/tts/types.ts:'gandr'added to theTtsProviderunion, plus aGandrTtsParamsinterface (voicesgandr-mia,gandr-ava,gandr-jenny,gandr-dane,gandr-leo,gandr-lewis; formatsmp3,wav,pcm).apps/sim/tools/tts/index.ts: exportsgandrTtsTool.apps/sim/lib/internal/tts/client.ts:synthesizeGandrposts tohttps://tts.gandr.ai/v1/audio/speechwith a Bearer key and body{"model": "tts-1", "input": text, "voice": voice, "response_format": format}, using the sharedproviderFetch, error reader, and audio size limits. Gandr accepts up to 2000 characters per request, so longer text raises aTtsOperationErrorwith status 400 instead of a silent provider error.apps/sim/lib/internal/tts/operations.ts:executeGandrTtsstores audio through the sharedstoreUnifiedAudiopath.apps/sim/lib/internal/tts/execute-tool.ts:tts_gandrzod schema (voice and format enums) and its switch case.apps/sim/lib/internal/tool-operations/registry.server.ts:'tts_gandr'added toTTS_TOOL_IDS.apps/sim/tools/registry.ts: import andtts_gandr: gandrTtsToolregistry entry.apps/sim/blocks/blocks/tts.ts: Gandr in the provider dropdown, a voice dropdown and an audio format dropdown gated onprovider === 'gandr', thetools.accessentry, the tool selector case, the params mapping, and the updated provider list strings.apps/sim/tools/tts/operations.test.ts:gandrTtsTooladded to the declaration checks and an input materialization expectation matching the OpenAI one.Verification: at this branch's base commit,
vitest run tools/tts/operations.test.tsfromapps/simpasses (1 file, 2 tests). I ran it with--pool=forksbecause the default thread pool fails in my headless environment independent of this change;bun installthere also needed--ignore-scriptssince isolated-vm's native build wants system toolchain pieces. Neither flag touches what this PR changes.About the provider: Gandr is a text to speech API with six stock voices, support for 23 languages, and a watermark on every render. Keys come from https://gandr.ai; the free tier includes 50,000 tokens. The API is OpenAI compatible, which is why the request in
client.tslooks like the OpenAI one with a different base URL.No behavior changes for the existing providers. The new provider only runs when a user selects Gandr in the block.
Disclosure: I work on Gandr.