From 69c2e16c824e14838e33094442f1703a050625cc Mon Sep 17 00:00:00 2001
From: Marcus Schiesser <mail@marcusschiesser.de>
Date: Wed, 22 May 2024 13:04:35 +0200
Subject: [PATCH] fix: streaming for express

---
 .changeset/three-cameras-change.md                           | 5 +++++
 .../streaming/express/src/controllers/chat.controller.ts     | 3 +--
 2 files changed, 6 insertions(+), 2 deletions(-)
 create mode 100644 .changeset/three-cameras-change.md

diff --git a/.changeset/three-cameras-change.md b/.changeset/three-cameras-change.md
new file mode 100644
index 00000000..ba142d30
--- /dev/null
+++ b/.changeset/three-cameras-change.md
@@ -0,0 +1,5 @@
+---
+"create-llama": patch
+---
+
+Fix streaming for Express
diff --git a/templates/types/streaming/express/src/controllers/chat.controller.ts b/templates/types/streaming/express/src/controllers/chat.controller.ts
index 3de1ac6b..c96ded0d 100644
--- a/templates/types/streaming/express/src/controllers/chat.controller.ts
+++ b/templates/types/streaming/express/src/controllers/chat.controller.ts
@@ -64,9 +64,8 @@ export const chat = async (req: Request, res: Response) => {
         image_url: data?.imageUrl,
       },
     });
-    const processedStream = stream.pipeThrough(vercelStreamData.stream);
 
-    return streamToResponse(processedStream, res);
+    return streamToResponse(stream, res, {}, vercelStreamData);
   } catch (error) {
     console.error("[LlamaIndex]", error);
     return res.status(500).json({
-- 
GitLab