From 81a6e249e1f44c2e56536638cb535b9c98243ea6 Mon Sep 17 00:00:00 2001 From: VarunJoshi10 Date: Thu, 11 Apr 2024 00:08:21 +0530 Subject: [PATCH] added Code Gen Support --- src/api/leocode.ts | 12 +++++++++ src/common/ChatUI.tsx | 25 +++++++++++++++++- src/common/FileUploadComponent.tsx | 41 ++++++++++++++++++++++++++++++ src/helpers/determineNextChat.ts | 34 ++++++++++++++++++++----- src/state/chat.ts | 34 ++++++++++++++++++++++--- yarn.lock | 27 +++----------------- 6 files changed, 138 insertions(+), 35 deletions(-) create mode 100644 src/api/leocode.ts create mode 100644 src/common/FileUploadComponent.tsx diff --git a/src/api/leocode.ts b/src/api/leocode.ts new file mode 100644 index 0000000..a105932 --- /dev/null +++ b/src/api/leocode.ts @@ -0,0 +1,12 @@ +import axios, { AxiosResponse } from 'axios'; + +export async function LeofetchData(query: string): Promise { + try { + const response: AxiosResponse = await axios.get(`https://leo.tektorch.info/query/?q=${encodeURIComponent(query)}`); + return response.data; + } catch (error) { + console.error('Error fetching data:', error); + throw error; + } +} + diff --git a/src/common/ChatUI.tsx b/src/common/ChatUI.tsx index 9fec24e..4c5dffb 100644 --- a/src/common/ChatUI.tsx +++ b/src/common/ChatUI.tsx @@ -8,6 +8,8 @@ import TaskStatus from './TaskStatus'; import PasswordComponent from './PasswordComponent'; import UpdatePasswordComponent from './UpdatePasswordComponent'; import CredentialsComponent from './CredentialsComponent'; +import FileUploadComponent from './FileUploadComponent'; + const ChatUI = () => { const [message, setMessage] = useState(''); @@ -22,7 +24,7 @@ const ChatUI = () => { const [password, setPassword] = useState(''); // State to store password const [privateKey, setPrivateKey] = useState(''); // State to store private key - const { history, addMessage, generateChat, showPasswordModal, setShowPasswordModal,showCredentialsModal,setShowCredentialsModal,showUpdatePasswordModal,setShowUpdatePasswordModal } = useChatStore(); + const { history, addMessage, generateChat, showPasswordModal, setShowPasswordModal,showCredentialsModal,setShowCredentialsModal,showUpdatePasswordModal,setShowUpdatePasswordModal ,showFileUploadModal,setShowFileUploadModal,} = useChatStore(); const toast = useToast(); useEffect(() => { @@ -144,6 +146,27 @@ const ChatUI = () => { + + {/* File Upload Modal */} + setShowFileUploadModal(false)}> + + + Upload File + + + { + setFile(file); + setFileName(file.name); + setIsFileAttached(true); + setShowFileUploadModal(false); + }} /> + + + + + + +