diff --git a/web/src/api/buster_socket/chats/chatResponses.ts b/web/src/api/buster_socket/chats/chatResponses.ts index 32390c731..ea460af71 100644 --- a/web/src/api/buster_socket/chats/chatResponses.ts +++ b/web/src/api/buster_socket/chats/chatResponses.ts @@ -10,7 +10,6 @@ export enum ChatsResponses { '/chats/list:getChatsList' = '/chats/list:getChatsList', '/chats/unsubscribe:unsubscribe' = '/chats/unsubscribe:unsubscribe', '/chats/get:getChat' = '/chats/get:getChat', - '/chats/get:getChatAsset' = '/chats/get:getChatAsset', '/chats/post:initializeChat' = '/chats/post:initializeChat', '/chats/post:generatingTitle' = '/chats/post:generatingTitle', '/chats/post:generatingResponseMessage' = '/chats/post:generatingResponseMessage', @@ -43,12 +42,6 @@ export type Chat_unsubscribe = { onError?: (d: unknown | RustApiError) => void; }; -export type Chat_getChatAsset = { - route: '/chats/get:getChatAsset'; - callback: (d: BusterChat) => void; - onError?: (d: unknown | RustApiError) => void; -}; - /***** CHAT PROGRESS EVENTS START ******/ export type ChatPost_initializeChat = { @@ -87,7 +80,6 @@ export type ChatResponseTypes = | ChatList_getChatsList | Chat_unsubscribe | Chat_getChat - | Chat_getChatAsset | ChatPost_initializeChat | ChatPost_generatingTitle | ChatPost_generatingResponseMessage diff --git a/web/src/app/app/_components/NewChatModal/NewChatModal.tsx b/web/src/app/app/_components/NewChatModal/NewChatModal.tsx index 8d318ec9c..61956e6d8 100644 --- a/web/src/app/app/_components/NewChatModal/NewChatModal.tsx +++ b/web/src/app/app/_components/NewChatModal/NewChatModal.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useMemo, useRef, useState } from 'react'; -import { Button, Modal, Input, InputRef, ConfigProvider, Divider, ThemeConfig } from 'antd'; +import { Button, Modal, Input, InputRef, ConfigProvider, ThemeConfig } from 'antd'; import { AppMaterialIcons } from '@/components/icons'; import { useMemoizedFn, useMount, useThrottleFn } from 'ahooks'; import { useAntToken } from '@/styles/useAntToken'; @@ -71,9 +71,10 @@ export const NewChatModal = React.memo<{ const { run: debouncedGetSuggestedChatPrompts } = useThrottleFn( async (v: string) => { try { - const prompts = await getSuggestedChatPrompts(v); - setSuggestedPrompts(prompts); - return prompts; + // const prompts = await getSuggestedChatPrompts(v); + // setSuggestedPrompts(prompts); + // return prompts; + return []; } catch (e) { openErrorNotification(e); } @@ -87,10 +88,6 @@ export const NewChatModal = React.memo<{ }); }); - const onCloseOrCancel = useMemoizedFn(() => { - onClose(); - }); - useEffect(() => { if (open) { if (defaultSuggestedPrompts.length === 0) { @@ -112,9 +109,9 @@ export const NewChatModal = React.memo<{ @@ -179,6 +177,10 @@ const NewChatInput: React.FC<{ activeItem: number | null; prompt: string; setPrompt: (prompt: string) => void; + selectedChatDataSource: { + id: string; + name: string; + } | null; }> = React.memo( ({ setSuggestedPrompts, @@ -187,7 +189,8 @@ const NewChatInput: React.FC<{ shownPrompts, lastKeyPressed, prompt, - setPrompt + setPrompt, + selectedChatDataSource }) => { const token = useAntToken(); const inputRef = useRef(null); @@ -195,10 +198,12 @@ const NewChatInput: React.FC<{ const onSelectSearchAsset = useBusterNewChatContextSelector((x) => x.onSelectSearchAsset); const [loadingNewChat, setLoadingNewChat] = useState(false); + console.log(selectedChatDataSource); + const onStartNewChatPreflight = useMemoizedFn(async () => { setLoadingNewChat(true); - await onStartNewChat(prompt); - await timeout(400); + await onStartNewChat({ prompt, datasetId: selectedChatDataSource?.id }); + await timeout(380); setPrompt(''); setLoadingNewChat(false); }); @@ -269,6 +274,8 @@ const NewChatInput: React.FC<{