()
| 50 | const [imageFile, setImageFile] = useState<File | null>(null) |
| 51 | |
| 52 | const connectionOptions = () => { |
| 53 | const body = { provider, testId, aimockPort } |
| 54 | |
| 55 | if (mode === 'sse') { |
| 56 | return { connection: fetchServerSentEvents('/api/video'), body } |
| 57 | } |
| 58 | if (mode === 'http-stream') { |
| 59 | return { connection: fetchHttpStream('/api/video/stream'), body } |
| 60 | } |
| 61 | return { |
| 62 | fetcher: async (input: { prompt: MediaPrompt }) => { |
| 63 | return generateVideoFn({ |
| 64 | data: { prompt: input.prompt, provider, aimockPort, testId }, |
| 65 | }) as Promise<VideoGenerateResult> |
| 66 | }, |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | const { generate, result, videoStatus, isLoading, error, status } = |
| 71 | useGenerateVideo(connectionOptions()) |
no test coverage detected