MCPcopy Index your code
hub / github.com/TanStack/ai / connectionOptions

Function connectionOptions

testing/e2e/src/components/TTSUI.tsx:27–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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())

Callers 1

TTSUIFunction · 0.70

Calls 2

fetchServerSentEventsFunction · 0.85
fetchHttpStreamFunction · 0.85

Tested by

no test coverage detected