Skip to content

feat(voice): add Sarvam AI (Saaras v4) speech-to-text provider - #496

Merged
SiddDevZ merged 1 commit into
DuskBotAI:devfrom
Satya-Siba-Nayak:feat/sarvam-voice-stt
Dec 3, 2026
Merged

SiddDevZ merged 1 commit into
DuskBotAI:devfrom
Satya-Siba-Nayak:feat/sarvam-voice-stt

Conversation

@Satya-Siba-Nayak

Copy link
Copy Markdown
Contributor

Closes #495.

Summary

Adds Sarvam AI (saaras:v4, fallback saaras:v3) as a speech-to-text provider in Settings > Voice for both desktop and mobile dictation.

Changes

  • electron/voice-catalog.mjs & electron/voice-catalog.d.mts:
    • Registers sarvam (Sarvam AI) in VOICE_PROVIDERS and VOICE_PROVIDER_INFO with default model saaras:v4 (and saaras:v3), key: "required", and keyUrl: "https://dashboard.sarvam.ai/key-management".
    • Automatically wires key storage (voiceInputKeys on desktop, Keychain/Keystore on mobile) and Settings > Voice UI rows via the shared catalog.
  • electron/voice-providers.mjs:
    • Adds Sarvam AI transcription in transcribeClip: posts WAV multipart/form-data to https://api.sarvam.ai/speech-to-text with header api-subscription-key, model, mode: "transcribe", and language_code, reading body.transcript.
    • Adds sarvamLanguage(tag) to normalize BCP-47 tags to Sarvam's supported *-IN language codes (en-* -> en-IN, or-* -> od-IN, supported Indic languages -> <lang>-IN) and fall back to unknown (auto-detect) when unset or outside Sarvam's supported set.
  • Tests:
    • Added Sarvam AI clip transcription and language mapping tests in electron/voice-providers.node-test.mjs.
    • Updated electron/voice-input-main.node-test.mjs (voiceKeyStatus and sessionOptions for sarvam / saaras:v4) and src/lib/voice-input/voice-input.test.ts (resolveEngine, providerReady, providerRunsOn).

Intentionally left out

  • Server-side listening / Vault key (server/tts/listen.ts, server/config.ts, key-catalog.ts): Left out to keep this PR small and focused on Settings > Voice dictation without adding untranslated Vault locale keys.
  • Sarvam WebSocket streaming (wss://api.sarvam.ai/speech-to-text/ws): Uses the existing piece-based batch session (realtime: false) for now.

Verification

  • pnpm lint (0 warnings, 0 errors)
  • pnpm typecheck
  • node --test electron/voice-providers.node-test.mjs electron/voice-input-main.node-test.mjs (38/38 passed)
  • pnpm exec vitest run src/lib/voice-input/ scripts/testing/file-size-ratchet.test.ts (6 files, 37/37 passed)

@SiddDevZ
SiddDevZ merged commit 3660245 into DuskBotAI:dev Dec 3, 2026
28 of 32 checks passed
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.

2 participants