From c0ed54406ffc9dc5c72ae7dbc592fe410d77dc8b Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Fri, 9 Feb 2024 18:04:24 +0530 Subject: [PATCH 1/3] fix(settings): delete button --- frontend/src/Setting.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/frontend/src/Setting.tsx b/frontend/src/Setting.tsx index b04cb18e..a8b76dd8 100644 --- a/frontend/src/Setting.tsx +++ b/frontend/src/Setting.tsx @@ -8,10 +8,10 @@ import { selectPrompt, setPrompt, selectSourceDocs, + setSourceDocs, } from './preferences/preferenceSlice'; import { Doc } from './preferences/preferenceApi'; import { useDarkTheme } from './hooks'; -import { Light } from 'react-syntax-highlighter'; type PromptProps = { prompts: { name: string; id: string; type: string }[]; selectedPrompt: { name: string; id: string; type: string }; @@ -86,13 +86,11 @@ const Setting: React.FC = () => { fetch(`${apiHost}/api/delete_old?path=${docPath}`, { method: 'GET', }) - .then(() => { - // remove the image element from the DOM - const imageElement = document.querySelector( - `#img-${index}`, - ) as HTMLElement; - const parentElement = imageElement.parentNode as HTMLElement; - parentElement.parentNode?.removeChild(parentElement); + .then((response) => { + if(response.ok && documents){ + const updatedDocuments = [...documents.slice(0, index), ...documents.slice(index + 1)]; + dispatch(setSourceDocs(updatedDocuments)); + } }) .catch((error) => console.error(error)); }; From 9129f7fb33dffe8f8acddace1ab8d9279c72f3e6 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Fri, 9 Feb 2024 19:12:48 +0530 Subject: [PATCH 2/3] fix(Conversation): input box UI --- frontend/src/conversation/Conversation.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index 6813ed0f..eb5a9aaf 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -140,12 +140,12 @@ export default function Conversation() { )} {queries.length > 0 && ( -
+
{queries.map((query, index) => { return ( )} -
+
{ if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); @@ -200,7 +200,7 @@ export default function Conversation() {
)}
-

+

This is a chatbot that uses the GPT-3, Faiss and LangChain to answer questions.

From 8826f0ff3c3381b461a7ef91725885dde1ac4000 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Fri, 9 Feb 2024 19:17:26 +0530 Subject: [PATCH 3/3] slight UI improvements in input box --- frontend/src/conversation/Conversation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index eb5a9aaf..ba311446 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -160,7 +160,7 @@ export default function Conversation() { {queries.length === 0 && ( )} -
+