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,31 +118,34 @@ 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',
{!stateModel.loading && ( downloadedModels.filter(
<Trash2Icon (x) => x.name === currentConvo?.name
size={16} ).length === 0 && '-mt-1'
className="cursor-pointer text-muted-foreground" )}
onClick={() => deleteConvo()} >
/> {downloadedModels.filter((x) => x.name === currentConvo?.name)
)} .length === 0 && (
</Fragment>
) : (
<div>
<Button <Button
themes="secondary" themes="secondary"
size="sm" size="sm"
className="-mt-1"
onClick={() => { onClick={() => {
setMainViewState(MainViewState.ExploreModels) setMainViewState(MainViewState.ExploreModels)
}} }}
> >
Download Model Download Model
</Button> </Button>
</div> )}
)} {!stateModel.loading && (
<Trash2Icon
size={16}
className="cursor-pointer text-muted-foreground"
onClick={() => deleteConvo()}
/>
)}
</div>
</div> </div>
</div> </div>
)} )}