Enable download conversation after deleted model

This commit is contained in:
Faisal Amir 2023-11-11 21:02:34 +07:00
parent 5e6e770738
commit 5a197f1e73

View File

@ -6,6 +6,8 @@ import { Button, Badge, Textarea } from '@janhq/uikit'
import { useAtom, useAtomValue } from 'jotai' import { useAtom, useAtomValue } from 'jotai'
import { Trash2Icon } from 'lucide-react' import { Trash2Icon } from 'lucide-react'
import { twMerge } from 'tailwind-merge'
import { currentPromptAtom } from '@/containers/Providers/Jotai' import { currentPromptAtom } from '@/containers/Providers/Jotai'
import { MainViewState } from '@/constants/screens' import { MainViewState } from '@/constants/screens'
@ -116,9 +118,26 @@ const ChatScreen = () => {
<div className="h-[53px] flex-shrink-0 border-b border-border bg-background p-4"> <div className="h-[53px] flex-shrink-0 border-b border-border bg-background p-4">
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<span>{currentConvo?.name ?? ''}</span> <span>{currentConvo?.name ?? ''}</span>
{downloadedModels.find((x) => x.name === currentConvo?.name) || <div
activeModel?._id === currentConvo?.modelId ? ( className={twMerge(
<Fragment> 'flex items-center space-x-3',
downloadedModels.filter(
(x) => x.name === currentConvo?.name
).length === 0 && '-mt-1'
)}
>
{downloadedModels.filter((x) => x.name === currentConvo?.name)
.length === 0 && (
<Button
themes="secondary"
size="sm"
onClick={() => {
setMainViewState(MainViewState.ExploreModels)
}}
>
Download Model
</Button>
)}
{!stateModel.loading && ( {!stateModel.loading && (
<Trash2Icon <Trash2Icon
size={16} size={16}
@ -126,21 +145,7 @@ const ChatScreen = () => {
onClick={() => deleteConvo()} onClick={() => deleteConvo()}
/> />
)} )}
</Fragment>
) : (
<div>
<Button
themes="secondary"
size="sm"
className="-mt-1"
onClick={() => {
setMainViewState(MainViewState.ExploreModels)
}}
>
Download Model
</Button>
</div> </div>
)}
</div> </div>
</div> </div>
)} )}