()
| 25 | provider === 'elevenlabs' ? ELEVENLABS_DEFAULT_VOICE : undefined |
| 26 | |
| 27 | const connectionOptions = () => { |
| 28 | const body = { provider, testId, aimockPort } |
| 29 | |
| 30 | if (mode === 'sse') { |
| 31 | return { connection: fetchServerSentEvents('/api/tts'), body } |
| 32 | } |
| 33 | if (mode === 'http-stream') { |
| 34 | return { connection: fetchHttpStream('/api/tts/stream'), body } |
| 35 | } |
| 36 | return { |
| 37 | fetcher: async (input: { text: string; voice?: string }) => { |
| 38 | return generateSpeechFn({ |
| 39 | data: { |
| 40 | text: input.text, |
| 41 | voice: input.voice, |
| 42 | provider, |
| 43 | aimockPort, |
| 44 | testId, |
| 45 | }, |
| 46 | }) as Promise<TTSResult> |
| 47 | }, |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | const { generate, result, isLoading, error, status } = |
| 52 | useGenerateSpeech(connectionOptions()) |
no test coverage detected