diff --git a/packages/hub/src/app/ai/api/create/route.ts b/packages/hub/src/app/ai/api/create/route.ts index 17a3e0502a..516a9cc5c5 100644 --- a/packages/hub/src/app/ai/api/create/route.ts +++ b/packages/hub/src/app/ai/api/create/route.ts @@ -156,11 +156,11 @@ export async function POST(req: Request) { saveWorkflowToDbOnUpdates(workflow); - const stream = workflow.runAsStream(); - // this is async but we don't need to wait for it createDbWorkflow(workflow, user); + const stream = workflow.runAsStream(); + return new Response(stream as ReadableStream, { headers: { "Content-Type": "text/event-stream",