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

Function useGenerateImage

packages/ai-react/src/use-generate-image.ts:98–126  ·  view source on GitHub ↗
(
  options: Omit<UseGenerateImageOptions, 'onResult'> & {
    onResult?: (result: ImageGenerationResult) => TTransformed
  },
)

Source from the content-addressed store, hash-verified

96 * ```
97 */
98export function useGenerateImage<TTransformed = void>(
99 options: Omit<UseGenerateImageOptions, 'onResult'> & {
100 onResult?: (result: ImageGenerationResult) => TTransformed
101 },
102): UseGenerateImageReturn<
103 InferGenerationOutputFromReturn<ImageGenerationResult, TTransformed>
104> {
105 const devtools = {
106 ...options.devtools,
107 framework: 'react',
108 hookName: 'useGenerateImage',
109 outputKind: 'image' as const,
110 }
111 const { generate, result, isLoading, error, status, stop, reset } =
112 useGeneration<ImageGenerateInput, ImageGenerationResult, TTransformed>({
113 ...options,
114 devtools,
115 })
116
117 return {
118 generate: generate as (input: ImageGenerateInput) => Promise<void>,
119 result,
120 isLoading,
121 error,
122 status,
123 stop,
124 reset,
125 }
126}

Callers 7

GenerationHooksPageFunction · 0.90
StreamingImageGenerationFunction · 0.90
DirectImageGenerationFunction · 0.90
ServerFnImageGenerationFunction · 0.90
ImageGenUIFunction · 0.90

Calls 1

useGenerationFunction · 0.90

Tested by

no test coverage detected