From 8c535e4a2b09f4cfc0837882deaf42fb52f4e5db Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 26 Mar 2024 14:03:12 +0700 Subject: [PATCH] fix: load model fails - generating button is not updated --- web/hooks/useActiveModel.ts | 5 ++++- web/hooks/useSendChatMessage.ts | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/web/hooks/useActiveModel.ts b/web/hooks/useActiveModel.ts index 0da28efe4f..546d78dc65 100644 --- a/web/hooks/useActiveModel.ts +++ b/web/hooks/useActiveModel.ts @@ -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) diff --git a/web/hooks/useSendChatMessage.ts b/web/hooks/useSendChatMessage.ts index b380320091..fb74574f0c 100644 --- a/web/hooks/useSendChatMessage.ts +++ b/web/hooks/useSendChatMessage.ts @@ -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 } }