diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index cfc7a825..28472969 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,18 @@ 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

+
+
@@ -85,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/assets/message.svg b/frontend/src/assets/message.svg new file mode 100644 index 00000000..927beaf2 --- /dev/null +++ b/frontend/src/assets/message.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index 9fc770fe..cc38c2a8 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -35,20 +35,20 @@ export default function Conversation() { return ( ); })} - {messages.length === 0 && } + {messages.length === 0 && }
-
+
{status === 'loading' ? ( )}
+

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

); } diff --git a/frontend/src/preferences/APIKeyModal.tsx b/frontend/src/preferences/APIKeyModal.tsx index b440500a..6dc49de2 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 691f90c1..36919632 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. +

+ )} +
+
+
+ ); +} diff --git a/frontend/tailwind.config.cjs b/frontend/tailwind.config.cjs index 73cc3eda..2eb37ff9 100644 --- a/frontend/tailwind.config.cjs +++ b/frontend/tailwind.config.cjs @@ -12,8 +12,10 @@ module.exports = { jet: '#343541', 'gray-alpha': 'rgba(0,0,0, .1)', 'gray-1000': '#F6F6F6', + 'gray-2000': 'rgba(0, 0, 0, 0.5)', + 'gray-3000': 'rgba(243, 243, 243, 1)', 'red-1000': 'rgb(254, 202, 202)', - 'red-2000' : '#F44336', + 'red-2000': '#F44336', 'red-3000': '#621B16', }, },