From 75a9543e6ca881da4e2b7066adedea74291fc216 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Tue, 11 Feb 2025 11:22:27 -0700 Subject: [PATCH] Update NewChatProvider.tsx --- .../Chats/NewChatProvider/NewChatProvider.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/web/src/context/Chats/NewChatProvider/NewChatProvider.tsx b/web/src/context/Chats/NewChatProvider/NewChatProvider.tsx index 54f1c30b9..4364922fe 100644 --- a/web/src/context/Chats/NewChatProvider/NewChatProvider.tsx +++ b/web/src/context/Chats/NewChatProvider/NewChatProvider.tsx @@ -26,7 +26,21 @@ export const useBusterNewChat = () => { const onStartNewChat = useMemoizedFn(async (prompt: string) => { console.log('start new chat'); - await new Promise((resolve) => setTimeout(resolve, 1000)); + startListeningForChatProgress(); + const result = await busterSocket.emitAndOnce({ + emitEvent: { + route: '/chats/post', + payload: { + dataset_id: null, //TODO: add selected dataset id + prompt + } + }, + responseEvent: { + route: '/chats/post:complete', + callback: completeChatCallback + } + }); + stopListeningForChatProgress(); }); const onStartChatFromFile = useMemoizedFn( @@ -60,7 +74,6 @@ export const useBusterNewChat = () => { callback: completeChatCallback } }); - stopListeningForChatProgress(); } );