From 01320798423db4b3f9583b15fb8ad9c759211aed Mon Sep 17 00:00:00 2001 From: ajaythapliyal Date: Fri, 24 Feb 2023 07:59:19 +0530 Subject: [PATCH 1/6] fixes 1. from Nicks list --- frontend/src/preferences/APIKeyModal.tsx | 2 +- frontend/src/preferences/SelectDocsModal.tsx | 264 +++++++++---------- 2 files changed, 133 insertions(+), 133 deletions(-) diff --git a/frontend/src/preferences/APIKeyModal.tsx b/frontend/src/preferences/APIKeyModal.tsx index b440500..6dc49de 100644 --- a/frontend/src/preferences/APIKeyModal.tsx +++ b/frontend/src/preferences/APIKeyModal.tsx @@ -41,7 +41,7 @@ export default function APIKeyModal({ >

OpenAI API Key

-

+

Before you can start using DocsGPT we need you to provide an API key for llm. Currently, we support only OpenAI but soon many more. You can find it here. diff --git a/frontend/src/preferences/SelectDocsModal.tsx b/frontend/src/preferences/SelectDocsModal.tsx index 691f90c..3691963 100644 --- a/frontend/src/preferences/SelectDocsModal.tsx +++ b/frontend/src/preferences/SelectDocsModal.tsx @@ -1,132 +1,132 @@ -import { useEffect, useState } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import { ActiveState } from '../models/misc'; -import { - setSelectedDocs, - setSourceDocs, - selectSourceDocs, -} from './preferenceSlice'; -import { getDocs, Doc } from './selectDocsApi'; - -export default function APIKeyModal({ - modalState, - setModalState, - isCancellable = true, -}: { - modalState: ActiveState; - setModalState: (val: ActiveState) => void; - isCancellable?: boolean; -}) { - const dispatch = useDispatch(); - const docs = useSelector(selectSourceDocs); - const [localSelectedDocs, setLocalSelectedDocs] = useState(null); - const [isDocsListOpen, setIsDocsListOpen] = useState(false); - const [isError, setIsError] = useState(false); - - function handleSubmit() { - if (!localSelectedDocs) { - setIsError(true); - } else { - dispatch(setSelectedDocs(localSelectedDocs)); - setModalState('INACTIVE'); - setLocalSelectedDocs(null); - setIsError(false); - } - } - - function handleCancel() { - setLocalSelectedDocs(null); - setIsError(false); - setModalState('INACTIVE'); - } - - useEffect(() => { - async function requestDocs() { - const data = await getDocs(); - dispatch(setSourceDocs(data)); - } - - requestDocs(); - }, []); - - return ( -

-
-

Select Source Documentation

-

- Please select the library of documentation that you would like to use - with our app. -

-
-
setIsDocsListOpen(!isDocsListOpen)} - > - {!localSelectedDocs ? ( -

Select

- ) : ( -

- {localSelectedDocs.name} {localSelectedDocs.version} -

- )} -
- {isDocsListOpen && ( -
- {docs ? ( - docs.map((doc, index) => { - if (doc.model) { - return ( -
{ - setLocalSelectedDocs(doc); - setIsDocsListOpen(false); - }} - className="h-10 w-full cursor-pointer border-x-2 border-b-2 hover:bg-gray-100" - > -

- {doc.name} {doc.version} -

-
- ); - } - }) - ) : ( -
-

No default documentation.

-
- )} -
- )} -
-
- {isCancellable && ( - - )} - - {isError && ( -

- Please select source documentation. -

- )} -
-
-
- ); -} +import { useEffect, useState } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import { ActiveState } from '../models/misc'; +import { + setSelectedDocs, + setSourceDocs, + selectSourceDocs, +} from './preferenceSlice'; +import { getDocs, Doc } from './selectDocsApi'; + +export default function APIKeyModal({ + modalState, + setModalState, + isCancellable = true, +}: { + modalState: ActiveState; + setModalState: (val: ActiveState) => void; + isCancellable?: boolean; +}) { + const dispatch = useDispatch(); + const docs = useSelector(selectSourceDocs); + const [localSelectedDocs, setLocalSelectedDocs] = useState(null); + const [isDocsListOpen, setIsDocsListOpen] = useState(false); + const [isError, setIsError] = useState(false); + + function handleSubmit() { + if (!localSelectedDocs) { + setIsError(true); + } else { + dispatch(setSelectedDocs(localSelectedDocs)); + setModalState('INACTIVE'); + setLocalSelectedDocs(null); + setIsError(false); + } + } + + function handleCancel() { + setLocalSelectedDocs(null); + setIsError(false); + setModalState('INACTIVE'); + } + + useEffect(() => { + async function requestDocs() { + const data = await getDocs(); + dispatch(setSourceDocs(data)); + } + + requestDocs(); + }, []); + + return ( +
+
+

Select Source Documentation

+

+ Please select the library of documentation that you would like to use + with our app. +

+
+
setIsDocsListOpen(!isDocsListOpen)} + > + {!localSelectedDocs ? ( +

Select

+ ) : ( +

+ {localSelectedDocs.name} {localSelectedDocs.version} +

+ )} +
+ {isDocsListOpen && ( +
+ {docs ? ( + docs.map((doc, index) => { + if (doc.model) { + return ( +
{ + setLocalSelectedDocs(doc); + setIsDocsListOpen(false); + }} + className="h-10 w-full cursor-pointer border-x-2 border-b-2 hover:bg-gray-100" + > +

+ {doc.name} {doc.version} +

+
+ ); + } + }) + ) : ( +
+

No default documentation.

+
+ )} +
+ )} +
+
+ {isCancellable && ( + + )} + + {isError && ( +

+ Please select source documentation. +

+ )} +
+
+
+ ); +} From 2bfba4cce852ebe63391b70ab9f40a2161c4016c Mon Sep 17 00:00:00 2001 From: ajaythapliyal Date: Fri, 24 Feb 2023 08:13:21 +0530 Subject: [PATCH 2/6] fixes 2 from nicks list --- 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 9fc770f..9a8f64b 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -42,7 +42,7 @@ export default function Conversation() { > ); })} - {messages.length === 0 && } + {messages.length === 0 && }
Date: Fri, 24 Feb 2023 08:43:42 +0530 Subject: [PATCH 3/6] adds a chat menu in Navbar --- frontend/src/Navigation.tsx | 9 +++++++++ frontend/src/assets/message.svg | 3 +++ 2 files changed, 12 insertions(+) create mode 100644 frontend/src/assets/message.svg diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index cfc7a82..7f9f65d 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -1,5 +1,6 @@ import { NavLink } from 'react-router-dom'; import Arrow1 from './assets/arrow.svg'; +import Message from './assets/message.svg'; import Hamburger from './assets/hamburger.svg'; import Key from './assets/key.svg'; import Info from './assets/info.svg'; @@ -56,6 +57,14 @@ export default function Navigation({ />
+ + +

Chat

+
+
diff --git a/frontend/src/assets/message.svg b/frontend/src/assets/message.svg new file mode 100644 index 0000000..927beaf --- /dev/null +++ b/frontend/src/assets/message.svg @@ -0,0 +1,3 @@ + + + From 3e20e4dc67de07745b66cd7470a163329ffb247d Mon Sep 17 00:00:00 2001 From: ajaythapliyal Date: Fri, 24 Feb 2023 09:25:03 +0530 Subject: [PATCH 4/6] fixes .6 from nicks list --- frontend/src/conversation/Conversation.tsx | 8 ++++++-- frontend/tailwind.config.cjs | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index 9a8f64b..ab00f0f 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -44,11 +44,11 @@ export default function Conversation() { })} {messages.length === 0 && }
-
+
{status === 'loading' ? ( )}
+

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

); } diff --git a/frontend/tailwind.config.cjs b/frontend/tailwind.config.cjs index 73cc3ed..3f1230e 100644 --- a/frontend/tailwind.config.cjs +++ b/frontend/tailwind.config.cjs @@ -12,8 +12,9 @@ module.exports = { jet: '#343541', 'gray-alpha': 'rgba(0,0,0, .1)', 'gray-1000': '#F6F6F6', + 'gray-2000': 'rgba(0, 0, 0, 0.5)', 'red-1000': 'rgb(254, 202, 202)', - 'red-2000' : '#F44336', + 'red-2000': '#F44336', 'red-3000': '#621B16', }, }, From d1d478ea29990fbf93533395de9281427eacc32b Mon Sep 17 00:00:00 2001 From: ajaythapliyal Date: Fri, 24 Feb 2023 09:33:18 +0530 Subject: [PATCH 5/6] fixes chatbubble padding --- 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 ab00f0f..192ad90 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -35,7 +35,7 @@ export default function Conversation() { return ( Date: Fri, 24 Feb 2023 16:41:58 +0530 Subject: [PATCH 6/6] pushing Hero down a bit and adding active states in routed links --- frontend/src/Navigation.tsx | 12 ++++++++++-- frontend/src/conversation/Conversation.tsx | 2 +- frontend/tailwind.config.cjs | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 7f9f65d..2847296 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -59,7 +59,11 @@ export default function Navigation({
+ `${ + isActive ? 'bg-gray-3000' : '' + } my-auto mx-4 mt-4 flex h-12 cursor-pointer gap-4 rounded-md hover:bg-gray-100` + } >

Chat

@@ -94,7 +98,11 @@ export default function Navigation({
+ `my-auto mx-4 flex h-12 cursor-pointer gap-4 rounded-md hover:bg-gray-100 ${ + isActive ? 'bg-gray-3000' : '' + }` + } > info

About

diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index 192ad90..cc38c2a 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -42,7 +42,7 @@ export default function Conversation() { > ); })} - {messages.length === 0 && } + {messages.length === 0 && }