fix: load model fails - generating button is not updated (#2498)

This commit is contained in:
Louis 2024-03-27 15:52:06 +07:00 committed by GitHub
parent c5c46494eb
commit fe730fbe42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -43,7 +43,10 @@ export function useActiveModel() {
let model = downloadedModelsRef?.current.find((e) => e.id === modelId)
await stopModel().catch()
const error = await stopModel().catch((error: Error) => error)
if (error) {
return Promise.reject(error)
}
setLoadModelError(undefined)

View File

@ -112,6 +112,7 @@ export default function useSendChatMessage() {
if (modelRef.current?.id !== modelId) {
const error = await startModel(modelId).catch((error: Error) => error)
if (error) {
updateThreadWaiting(activeThreadRef.current.id, false)
return
}
}