Showing a modal when user start conf but model not active
This commit is contained in:
parent
1d9be70d89
commit
6ea8eb1d50
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import BasicPromptInput from '../BasicPromptInput'
|
import BasicPromptInput from '../BasicPromptInput'
|
||||||
import BasicPromptAccessories from '../BasicPromptAccessories'
|
import BasicPromptAccessories from '../BasicPromptAccessories'
|
||||||
import { useAtomValue } from 'jotai'
|
import { useAtomValue, useSetAtom } from 'jotai'
|
||||||
import SecondaryButton from '../SecondaryButton'
|
import SecondaryButton from '../SecondaryButton'
|
||||||
import { PlusIcon } from '@heroicons/react/24/outline'
|
import { PlusIcon } from '@heroicons/react/24/outline'
|
||||||
import useCreateConversation from '@hooks/useCreateConversation'
|
import useCreateConversation from '@hooks/useCreateConversation'
|
||||||
@ -13,9 +13,9 @@ import {
|
|||||||
getActiveConvoIdAtom,
|
getActiveConvoIdAtom,
|
||||||
} from '@helpers/atoms/Conversation.atom'
|
} from '@helpers/atoms/Conversation.atom'
|
||||||
import useGetInputState from '@hooks/useGetInputState'
|
import useGetInputState from '@hooks/useGetInputState'
|
||||||
import { Button } from '../../../uikit/button'
|
|
||||||
import useStartStopModel from '@hooks/useStartStopModel'
|
import useStartStopModel from '@hooks/useStartStopModel'
|
||||||
import { userConversationsAtom } from '@helpers/atoms/Conversation.atom'
|
import { userConversationsAtom } from '@helpers/atoms/Conversation.atom'
|
||||||
|
import { showingModalNoActiveModel } from '@helpers/atoms/Modal.atom'
|
||||||
|
|
||||||
const InputToolbar: React.FC = () => {
|
const InputToolbar: React.FC = () => {
|
||||||
const activeModel = useAtomValue(activeAssistantModelAtom)
|
const activeModel = useAtomValue(activeAssistantModelAtom)
|
||||||
@ -25,12 +25,14 @@ const InputToolbar: React.FC = () => {
|
|||||||
const { startModel } = useStartStopModel()
|
const { startModel } = useStartStopModel()
|
||||||
const { loading } = useAtomValue(stateModel)
|
const { loading } = useAtomValue(stateModel)
|
||||||
const conversations = useAtomValue(userConversationsAtom)
|
const conversations = useAtomValue(userConversationsAtom)
|
||||||
|
|
||||||
const activeConvoId = useAtomValue(getActiveConvoIdAtom)
|
const activeConvoId = useAtomValue(getActiveConvoIdAtom)
|
||||||
|
const setShowModalNoActiveModel = useSetAtom(showingModalNoActiveModel)
|
||||||
|
|
||||||
const onNewConversationClick = () => {
|
const onNewConversationClick = () => {
|
||||||
if (activeModel) {
|
if (activeModel) {
|
||||||
requestCreateConvo(activeModel)
|
requestCreateConvo(activeModel)
|
||||||
|
} else {
|
||||||
|
setShowModalNoActiveModel(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,19 +45,21 @@ const InputToolbar: React.FC = () => {
|
|||||||
if (!activeConvoId) {
|
if (!activeConvoId) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
if (inputState === 'model-mismatch' || inputState === 'loading') {
|
(activeConvoId && inputState === 'model-mismatch') ||
|
||||||
const message =
|
inputState === 'loading'
|
||||||
inputState === 'loading' || loading ? 'Loading..' : 'Model mismatch!'
|
) {
|
||||||
|
// const message = inputState === 'loading' ? 'Loading..' : 'Model mismatch!'
|
||||||
return (
|
return (
|
||||||
<div className="sticky bottom-0 flex items-center justify-center bg-background/90">
|
<div className="sticky bottom-0 flex items-center justify-center bg-background/90">
|
||||||
<div className="mb-2">
|
<div className="my-2">
|
||||||
<p className="mx-auto my-5 line-clamp-2 text-ellipsis text-center italic text-gray-600">
|
{/* <p className="mx-auto my-5 line-clamp-2 text-ellipsis text-center italic text-gray-600">
|
||||||
{message}
|
{message}
|
||||||
</p>
|
</p> */}
|
||||||
<Button onClick={onStartModelClick}>
|
<SecondaryButton
|
||||||
Load {currentConvo?.modelId}
|
onClick={onStartModelClick}
|
||||||
</Button>
|
title={`Start model ${currentConvo?.modelId}`}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -39,7 +39,8 @@ const ModalNoActiveModel: React.FC = () => {
|
|||||||
>
|
>
|
||||||
<Dialog.Panel className="relative transform overflow-hidden rounded-lg border border-border bg-background/90 px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:p-6">
|
<Dialog.Panel className="relative transform overflow-hidden rounded-lg border border-border bg-background/90 px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:p-6">
|
||||||
<h1 className="font-base mb-4 font-bold">
|
<h1 className="font-base mb-4 font-bold">
|
||||||
There is no active model at the moment ...
|
You don’t have any actively running models. Please start a
|
||||||
|
downloaded model in My Models page to use this feature.
|
||||||
</h1>
|
</h1>
|
||||||
<div className="mt-5 sm:mt-4 sm:flex sm:flex-row-reverse">
|
<div className="mt-5 sm:mt-4 sm:flex sm:flex-row-reverse">
|
||||||
<button
|
<button
|
||||||
|
|||||||
@ -9,13 +9,13 @@ import LeftHeaderAction from '@/_components/LeftHeaderAction'
|
|||||||
const ChatScreen = () => {
|
const ChatScreen = () => {
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full">
|
<div className="flex h-full">
|
||||||
<div className="border-border flex h-full w-64 flex-shrink-0 flex-col overflow-y-auto border-r ">
|
<div className="flex h-full w-64 flex-shrink-0 flex-col overflow-y-auto border-r border-border ">
|
||||||
<div className="px-4 py-6 pt-4">
|
<div className="px-4 py-6 pt-4">
|
||||||
<LeftHeaderAction />
|
<LeftHeaderAction />
|
||||||
<HistoryList />
|
<HistoryList />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="bg-background/50 relative flex h-full w-full flex-col">
|
<div className="relative flex h-full w-full flex-col bg-background/50">
|
||||||
<MainHeader />
|
<MainHeader />
|
||||||
<ChatBody />
|
<ChatBody />
|
||||||
<InputToolbar />
|
<InputToolbar />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user