fix: wrong model available state check
This commit is contained in:
parent
6ec07ce10a
commit
df6e9802f6
@ -56,7 +56,7 @@ const ChatScreen = () => {
|
|||||||
const conversations = useAtomValue(userConversationsAtom)
|
const conversations = useAtomValue(userConversationsAtom)
|
||||||
const isEnableChat = (currentConvo && activeModel) || conversations.length > 0
|
const isEnableChat = (currentConvo && activeModel) || conversations.length > 0
|
||||||
const [isModelAvailable, setIsModelAvailable] = useState(
|
const [isModelAvailable, setIsModelAvailable] = useState(
|
||||||
downloadedModels.some((x) => x.name !== currentConvo?.name)
|
downloadedModels.some((x) => x._id === currentConvo?.modelId)
|
||||||
)
|
)
|
||||||
|
|
||||||
const textareaRef = useRef<HTMLTextAreaElement>(null)
|
const textareaRef = useRef<HTMLTextAreaElement>(null)
|
||||||
@ -72,9 +72,8 @@ const ChatScreen = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setIsModelAvailable(
|
setIsModelAvailable(
|
||||||
downloadedModels.some((x) => x.name !== currentConvo?.name)
|
downloadedModels.some((x) => x._id === currentConvo?.modelId)
|
||||||
)
|
)
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [currentConvo, downloadedModels])
|
}, [currentConvo, downloadedModels])
|
||||||
|
|
||||||
const handleSendMessage = async () => {
|
const handleSendMessage = async () => {
|
||||||
@ -131,10 +130,10 @@ const ChatScreen = () => {
|
|||||||
<div
|
<div
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
'flex items-center space-x-3',
|
'flex items-center space-x-3',
|
||||||
isModelAvailable && '-mt-1'
|
!isModelAvailable && '-mt-1'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{isModelAvailable && (
|
{!isModelAvailable && (
|
||||||
<Button
|
<Button
|
||||||
themes="secondary"
|
themes="secondary"
|
||||||
size="sm"
|
size="sm"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user