Skip to content

Commit e134d00

Browse files
committed
chore: fix model loading state
1 parent 292c303 commit e134d00

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

web/screens/Chat/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ const ChatScreen = () => {
6868

6969
const textareaRef = useRef<HTMLTextAreaElement>(null)
7070
const { startModel } = useActiveModel()
71+
const modelRef = useRef(activeModel)
72+
73+
useEffect(() => {
74+
modelRef.current = activeModel
75+
}, [activeModel])
7176

7277
useEffect(() => {
7378
getUserConversations()
@@ -95,7 +100,10 @@ const ChatScreen = () => {
95100
description: 'It will be sent once the model is done loading.',
96101
})
97102
startModel(model.id).then(() => {
98-
if (activeModel) sendChatMessage()
103+
setTimeout(() => {
104+
if (modelRef?.current?.id === currentConvo?.modelId)
105+
sendChatMessage()
106+
}, 300)
99107
})
100108
}
101109
return

0 commit comments

Comments
 (0)