From c40202fd04cb2541d88d2a25f2fc5dfc2128508c Mon Sep 17 00:00:00 2001
From: Dhravya <dhravyashah@gmail.com>
Date: Sun, 31 Mar 2024 22:44:22 -0700
Subject: added gemini streaming in cf-ai-backend

---
 apps/web/src/components/QueryAI.tsx | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'apps/web/src/components/QueryAI.tsx')

diff --git a/apps/web/src/components/QueryAI.tsx b/apps/web/src/components/QueryAI.tsx
index 811dd899..3cb14178 100644
--- a/apps/web/src/components/QueryAI.tsx
+++ b/apps/web/src/components/QueryAI.tsx
@@ -82,6 +82,11 @@ function QueryAI() {
 
     const response = await fetch(`/api/query?q=${input}`);
 
+    if (response.status !== 200) {
+      setIsAiLoading(false);
+      return;
+    }
+
     if (response.body) {
       let reader = response.body.getReader();
       let decoder = new TextDecoder('utf-8');
-- 
cgit v1.2.3

