Skip to content

Commit

Permalink
fix: load model fails - generating button is not updated (janhq#2498)
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan authored Mar 27, 2024
1 parent c5c4649 commit fe730fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion web/hooks/useActiveModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions web/hooks/useSendChatMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit fe730fb

Please sign in to comment.