fix(#388): address PR review findings — fix WebSocket/REST bugs, improve error handling, fix types and comments
Critical fixes: - Fix FormData field name mismatch (audio -> file) to match backend FileInterceptor - Add /speech namespace to WebSocket connection URL - Pass auth token in WebSocket handshake options - Wrap audio.play() in try-catch for NotAllowedError and DOMException handling - Replace bare catch block with named error parameter and descriptive message - Add connect_error and disconnect event handlers to WebSocket - Update JSDoc to accurately describe batch transcription (not real-time partial) Important fixes: - Emit transcription-error before disconnect in gateway auth failures - Capture MediaRecorder error details and clean up media tracks on error - Change TtsDefaultConfig.format type from string to AudioFormat - Define canonical SPEECH_TIERS and AUDIO_FORMATS arrays as single source of truth - Fix voice count from 54 to 53 in provider, AGENTS.md, and docs - Fix inaccurate comments (Piper formats, tier prop, SpeachesProvider, TextValidationPipe) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
import { registerAs } from "@nestjs/config";
|
||||
import type { AudioFormat } from "./interfaces/speech-types";
|
||||
|
||||
// ==========================================
|
||||
// Default values
|
||||
@@ -58,7 +59,7 @@ export interface TtsDefaultConfig {
|
||||
enabled: boolean;
|
||||
url: string;
|
||||
voice: string;
|
||||
format: string;
|
||||
format: AudioFormat;
|
||||
}
|
||||
|
||||
export interface TtsPremiumConfig {
|
||||
@@ -247,7 +248,7 @@ export function getSpeechConfig(): SpeechConfig {
|
||||
enabled: isTtsEnabled(),
|
||||
url: process.env.TTS_DEFAULT_URL ?? TTS_DEFAULT_DEFAULTS.url,
|
||||
voice: process.env.TTS_DEFAULT_VOICE ?? TTS_DEFAULT_DEFAULTS.voice,
|
||||
format: process.env.TTS_DEFAULT_FORMAT ?? TTS_DEFAULT_DEFAULTS.format,
|
||||
format: (process.env.TTS_DEFAULT_FORMAT ?? TTS_DEFAULT_DEFAULTS.format) as AudioFormat,
|
||||
},
|
||||
premium: {
|
||||
enabled: isTtsPremiumEnabled(),
|
||||
|
||||
Reference in New Issue
Block a user