From 1f4e5b4e539fd8cd63ba232521ca23f0f97e0de4 Mon Sep 17 00:00:00 2001 From: Vyacheslav Matyukhin Date: Thu, 5 Dec 2024 15:48:58 -0300 Subject: [PATCH] attempt to fix /ai --- packages/hub/src/app/ai/api/create/route.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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",