Skip to content

Commit

Permalink
Enable download conversation after deleted model
Browse files Browse the repository at this point in the history
  • Loading branch information
urmauur committed Nov 13, 2023
1 parent 5e6e770 commit 5a197f1
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions web/screens/Chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { Button, Badge, Textarea } from '@janhq/uikit'
import { useAtom, useAtomValue } from 'jotai'
import { Trash2Icon } from 'lucide-react'

import { twMerge } from 'tailwind-merge'

import { currentPromptAtom } from '@/containers/Providers/Jotai'

import { MainViewState } from '@/constants/screens'
Expand Down Expand Up @@ -116,31 +118,34 @@ const ChatScreen = () => {
<div className="h-[53px] flex-shrink-0 border-b border-border bg-background p-4">
<div className="flex items-center justify-between">
<span>{currentConvo?.name ?? ''}</span>
{downloadedModels.find((x) => x.name === currentConvo?.name) ||
activeModel?._id === currentConvo?.modelId ? (
<Fragment>
{!stateModel.loading && (
<Trash2Icon
size={16}
className="cursor-pointer text-muted-foreground"
onClick={() => deleteConvo()}
/>
)}
</Fragment>
) : (
<div>
<div
className={twMerge(
'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"
className="-mt-1"
onClick={() => {
setMainViewState(MainViewState.ExploreModels)
}}
>
Download Model
</Button>
</div>
)}
)}
{!stateModel.loading && (
<Trash2Icon
size={16}
className="cursor-pointer text-muted-foreground"
onClick={() => deleteConvo()}
/>
)}
</div>
</div>
</div>
)}
Expand Down

0 comments on commit 5a197f1

Please sign in to comment.