chore: unload model on message error - so users can attempt to start

This commit is contained in:
Louis 2024-10-22 15:38:32 +07:00
parent 40957f7686
commit 8ccbb56f95
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2
2 changed files with 4 additions and 1 deletions

View File

@ -179,6 +179,9 @@ export default function EventHandler({ children }: { children: ReactNode }) {
setIsGeneratingResponse(false) setIsGeneratingResponse(false)
} }
return return
} else if (message.status === MessageStatus.Error) {
setActiveModel(undefined)
setStateModel({ state: 'start', loading: false, model: undefined })
} }
// Mark the thread as not waiting for response // Mark the thread as not waiting for response
updateThreadWaiting(message.thread_id, false) updateThreadWaiting(message.thread_id, false)

View File

@ -53,7 +53,7 @@ export function useActiveModel() {
} }
if (activeModel) { if (activeModel) {
stopModel(activeModel) await stopModel(activeModel)
} }
setPendingModelLoad(true) setPendingModelLoad(true)