MCPcopy Create free account
hub / github.com/TanStack/ai / generate

Function generate

testing/e2e/src/components/AudioGenUI.tsx:45–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43 const [result, setResult] = useState<AudioGenerationResult | null>(null)
44
45 const generate = async () => {
46 if (!prompt.trim()) return
47 setIsLoading(true)
48 setError(null)
49 try {
50 const payload = { prompt, provider, testId, aimockPort, feature }
51 const next =
52 mode === 'fetcher'
53 ? await generateAudioFn({ data: payload })
54 : await fetchAudioViaRoute(payload)
55 setResult(next as AudioGenerationResult)
56 } catch (e) {
57 setError(e instanceof Error ? e : new Error(String(e)))
58 } finally {
59 setIsLoading(false)
60 }
61 }
62
63 const audioSrc = result
64 ? (result.audio.url ??

Callers 4

handleGenerateFunction · 0.70
TranscriptionUIFunction · 0.70
TTSUIFunction · 0.70
handleGenerateFunction · 0.70

Calls 1

fetchAudioViaRouteFunction · 0.85

Tested by

no test coverage detected