From 28e06fa684854c535046334afe52ecc8cdde2fb0 Mon Sep 17 00:00:00 2001 From: Siddhant Rai Date: Tue, 3 Sep 2024 16:11:24 +0530 Subject: [PATCH] fix: minor ui inconsistencies --- application/retriever/classic_rag.py | 9 +- frontend/src/components/Input.tsx | 8 +- frontend/src/components/types/index.ts | 1 + .../src/conversation/ConversationBubble.tsx | 2 +- frontend/src/index.css | 20 +++ frontend/src/upload/Upload.tsx | 135 ++++++++++-------- 6 files changed, 109 insertions(+), 66 deletions(-) diff --git a/application/retriever/classic_rag.py b/application/retriever/classic_rag.py index aef6e503..32f51234 100644 --- a/application/retriever/classic_rag.py +++ b/application/retriever/classic_rag.py @@ -61,13 +61,12 @@ class ClassicRAG(BaseRetriever): settings.VECTOR_STORE, self.vectorstore, settings.EMBEDDINGS_KEY ) docs_temp = docsearch.search(self.question, k=self.chunks) + print(docs_temp) docs = [ { - "title": ( - i.metadata["title"].split("/")[-1] - if i.metadata - else i.page_content - ), + "title": i.metadata.get( + "title", i.metadata.get("post_title", i.page_content) + ).split("/")[-1], "text": i.page_content, "source": ( i.metadata.get("source") diff --git a/frontend/src/components/Input.tsx b/frontend/src/components/Input.tsx index 56ca1d52..17e60190 100644 --- a/frontend/src/components/Input.tsx +++ b/frontend/src/components/Input.tsx @@ -10,6 +10,7 @@ const Input = ({ maxLength, className, colorVariant = 'silver', + borderVariant = 'thick', children, onChange, onPaste, @@ -20,10 +21,13 @@ const Input = ({ jet: 'border-jet', gray: 'border-gray-5000 dark:text-silver', }; - + const borderStyles = { + thin: 'border', + thick: 'border-2', + }; return ( 3 && (
setIsSidebarOpen(true)} >

{`View ${ diff --git a/frontend/src/index.css b/frontend/src/index.css index 6ae4b762..025059ac 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -424,6 +424,26 @@ template { width: 0; } +input:-webkit-autofill { + -webkit-box-shadow: 0 0 0 50px white inset; +} + +input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 50px white inset; +} + +@media (prefers-color-scheme: dark) { + input:-webkit-autofill { + -webkit-box-shadow: 0 0 0 50px rgb(68, 70, 84) inset; + -webkit-text-fill-color: white; + } + + input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 50px rgb(68, 70, 84) inset; + -webkit-text-fill-color: white; + } +} + .inputbox-style { resize: none; padding-left: 36px; diff --git a/frontend/src/upload/Upload.tsx b/frontend/src/upload/Upload.tsx index c5eed6d8..2641a8f8 100644 --- a/frontend/src/upload/Upload.tsx +++ b/frontend/src/upload/Upload.tsx @@ -275,7 +275,7 @@ function Upload({ } else setRedditData({ ...redditData, - [name]: value, + [name]: name === 'number_posts' ? parseInt(value) : value, }); }; @@ -321,6 +321,7 @@ function Upload({ colorVariant="gray" value={docName} onChange={(e) => setDocName(e.target.value)} + borderVariant="thin" >

@@ -356,6 +357,7 @@ function Upload({ {activeTab === 'remote' && ( <> @@ -371,6 +373,7 @@ function Upload({ type="text" value={urlName} onChange={(e) => setUrlName(e.target.value)} + borderVariant="thin" >
@@ -382,6 +385,7 @@ function Upload({ type="text" value={url} onChange={(e) => setUrl(e.target.value)} + borderVariant="thin" >
@@ -390,68 +394,83 @@ function Upload({
) : ( - <> - -
- - {t('modals.uploadDoc.reddit.id')} - +
+
+ +
+ + {t('modals.uploadDoc.reddit.id')} + +
- -
- - {t('modals.uploadDoc.reddit.secret')} - +
+ +
+ + {t('modals.uploadDoc.reddit.secret')} + +
- -
- - {t('modals.uploadDoc.reddit.agent')} - +
+ +
+ + {t('modals.uploadDoc.reddit.agent')} + +
- -
- - {t('modals.uploadDoc.reddit.searchQueries')} - +
+ +
+ + {t('modals.uploadDoc.reddit.searchQueries')} + +
- -
- - {t('modals.uploadDoc.reddit.numberOfPosts')} - +
+ +
+ + {t('modals.uploadDoc.reddit.numberOfPosts')} + +
- +
)} )}