export async function fetchGenerationOptions(): Promise { const response = await fetch("/api/comfy/models"); if (!response.ok) throw new Error("Unable to load ComfyUI models"); return response.json() as Promise; } export async function requestGeneration(body: unknown): Promise<{ source: string; mimeType: string }> { const response = await fetch("/api/comfy/generate", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body) }); if (!response.ok) throw new Error(await response.text()); return response.json() as Promise<{ source: string; mimeType: string }>; }