diff --git a/web/app/_components/HistoryList/index.tsx b/web/app/_components/HistoryList/index.tsx index 3dab9f411..880521597 100644 --- a/web/app/_components/HistoryList/index.tsx +++ b/web/app/_components/HistoryList/index.tsx @@ -1,33 +1,17 @@ import HistoryItem from '../HistoryItem' -import { Fragment, useEffect } from 'react' +import { useEffect } from 'react' import ExpandableHeader from '../ExpandableHeader' -import { useAtomValue, useSetAtom } from 'jotai' +import { useAtomValue } from 'jotai' import { searchAtom } from '@helpers/JotaiWrapper' import useGetUserConversations from '@hooks/useGetUserConversations' import SidebarEmptyHistory from '../SidebarEmptyHistory' import { userConversationsAtom } from '@helpers/atoms/Conversation.atom' import { twMerge } from 'tailwind-merge' -import { Button } from '@uikit' -import { activeAssistantModelAtom, stateModel } from '@helpers/atoms/Model.atom' -import useCreateConversation from '@hooks/useCreateConversation' -import { showingModalNoActiveModel } from '@helpers/atoms/Modal.atom' -import { PlusIcon } from '@heroicons/react/24/outline' const HistoryList: React.FC = () => { const conversations = useAtomValue(userConversationsAtom) const searchText = useAtomValue(searchAtom) const { getUserConversations } = useGetUserConversations() - const activeModel = useAtomValue(activeAssistantModelAtom) - const { requestCreateConvo } = useCreateConversation() - const setShowModalNoActiveModel = useSetAtom(showingModalNoActiveModel) - - const onNewConversationClick = () => { - if (activeModel) { - requestCreateConvo(activeModel) - } else { - setShowModalNoActiveModel(true) - } - } useEffect(() => { getUserConversations() @@ -35,37 +19,26 @@ const HistoryList: React.FC = () => { }, []) return ( -
+
{conversations.length > 0 ? ( - -
    - {conversations - .filter( - (e) => - searchText.trim() === '' || - e.name - ?.toLowerCase() - .includes(searchText.toLowerCase().trim()) - ) - .map((convo, i) => ( - - ))} -
- -
+
    + {conversations + .filter( + (e) => + searchText.trim() === '' || + e.name?.toLowerCase().includes(searchText.toLowerCase().trim()) + ) + .map((convo, i) => ( + + ))} +
) : ( )} diff --git a/web/app/_components/InputToolbar/index.tsx b/web/app/_components/InputToolbar/index.tsx index 4895d90cf..40cd140af 100644 --- a/web/app/_components/InputToolbar/index.tsx +++ b/web/app/_components/InputToolbar/index.tsx @@ -43,15 +43,7 @@ const InputToolbar: React.FC = () => { } if (!activeConvoId) { - return ( -
- } - /> -
- ) + return null } if ( (activeConvoId && inputState === 'model-mismatch') || @@ -94,13 +86,13 @@ const InputToolbar: React.FC = () => {
)} -
+ {/*
} /> -
+
*/} {/* My text input */}
diff --git a/web/app/_components/LeftHeaderAction/index.tsx b/web/app/_components/LeftHeaderAction/index.tsx index c506cb139..e8e978bc5 100644 --- a/web/app/_components/LeftHeaderAction/index.tsx +++ b/web/app/_components/LeftHeaderAction/index.tsx @@ -2,22 +2,37 @@ import React from 'react' import SecondaryButton from '../SecondaryButton' -import { useSetAtom } from 'jotai' +import { useSetAtom, useAtomValue } from 'jotai' import { MainViewState, setMainViewStateAtom, } from '@helpers/atoms/MainView.atom' import { MagnifyingGlassIcon, PlusIcon } from '@heroicons/react/24/outline' +import useCreateConversation from '@hooks/useCreateConversation' import { useGetDownloadedModels } from '@hooks/useGetDownloadedModels' +import { Button } from '@uikit' +import { activeAssistantModelAtom } from '@helpers/atoms/Model.atom' +import { showingModalNoActiveModel } from '@helpers/atoms/Modal.atom' const LeftHeaderAction: React.FC = () => { const setMainView = useSetAtom(setMainViewStateAtom) const { downloadedModels } = useGetDownloadedModels() + const activeModel = useAtomValue(activeAssistantModelAtom) + const { requestCreateConvo } = useCreateConversation() + const setShowModalNoActiveModel = useSetAtom(showingModalNoActiveModel) const onExploreClick = () => { setMainView(MainViewState.ExploreModel) } + const onNewConversationClick = () => { + if (activeModel) { + requestCreateConvo(activeModel) + } else { + setShowModalNoActiveModel(true) + } + } + const onCreateBotClicked = () => { if (downloadedModels.length === 0) { alert('You need to download at least one model to create a bot.') @@ -27,19 +42,28 @@ const LeftHeaderAction: React.FC = () => { } return ( -
- } - /> - } - /> +
+
+ } + /> + } + /> +
+
) } diff --git a/web/app/_components/SecondaryButton/index.tsx b/web/app/_components/SecondaryButton/index.tsx index 2491edeba..be1d85146 100644 --- a/web/app/_components/SecondaryButton/index.tsx +++ b/web/app/_components/SecondaryButton/index.tsx @@ -16,7 +16,13 @@ const SecondaryButton: React.FC = ({ className, icon, }) => ( - diff --git a/web/screens/Chat/index.tsx b/web/screens/Chat/index.tsx index fe3f0217c..5472ce067 100644 --- a/web/screens/Chat/index.tsx +++ b/web/screens/Chat/index.tsx @@ -10,10 +10,8 @@ const ChatScreen = () => { return (
-
- - -
+ +