()
| 26 | aimockPort, |
| 27 | }: TranscriptionUIProps) { |
| 28 | const connectionOptions = () => { |
| 29 | const body = { provider, testId, aimockPort } |
| 30 | |
| 31 | if (mode === 'sse') { |
| 32 | return { connection: fetchServerSentEvents('/api/transcription'), body } |
| 33 | } |
| 34 | if (mode === 'http-stream') { |
| 35 | return { connection: fetchHttpStream('/api/transcription/stream'), body } |
| 36 | } |
| 37 | return { |
| 38 | fetcher: async (input: TranscriptionGenerateInput) => { |
| 39 | return generateTranscriptionFn({ |
| 40 | data: { |
| 41 | audio: input.audio as string, |
| 42 | language: input.language, |
| 43 | provider, |
| 44 | aimockPort, |
| 45 | testId, |
| 46 | }, |
| 47 | }) as Promise<TranscriptionResult> |
| 48 | }, |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | const { generate, result, isLoading, error, status } = |
| 53 | useTranscription(connectionOptions()) |
no test coverage detected