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

Function connectionOptions

testing/e2e/src/components/ImageGenUI.tsx:46–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44 const [imageFile, setImageFile] = useState<File | null>(null)
45
46 const connectionOptions = () => {
47 const body = { provider, numberOfImages: 1, testId, aimockPort }
48
49 if (mode === 'sse') {
50 return { connection: fetchServerSentEvents('/api/image'), body }
51 }
52 if (mode === 'http-stream') {
53 return { connection: fetchHttpStream('/api/image/stream'), body }
54 }
55 return {
56 fetcher: async (input: { prompt: MediaPrompt }) => {
57 return generateImageFn({
58 data: {
59 prompt: input.prompt,
60 provider,
61 numberOfImages: 1,
62 aimockPort,
63 testId,
64 },
65 }) as Promise<ImageGenerationResult>
66 },
67 }
68 }
69
70 const { generate, result, isLoading, error, status } =
71 useGenerateImage(connectionOptions())

Callers 1

ImageGenUIFunction · 0.70

Calls 2

fetchServerSentEventsFunction · 0.85
fetchHttpStreamFunction · 0.85

Tested by

no test coverage detected