Merge pull request #4131 from janhq/fix/4012-active-model-stopped-on-process-exit

fix: 4012 - active model should be gone as soon as cortex.cpp server is killed
This commit is contained in:
Louis 2024-11-26 21:30:27 +07:00 committed by GitHub
commit 15588fa82a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -70,7 +70,7 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine {
super.onLoad()
this.queue.add(() => this.clean())
// Run the process watchdog
const systemInfo = await systemInformation()
this.queue.add(() => executeOnMain(NODE, 'run', systemInfo))
@ -251,6 +251,7 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine {
this.socket.onclose = (event) => {
console.log('WebSocket closed:', event)
events.emit(ModelEvent.OnModelStopped, {})
if (this.shouldReconnect) {
console.log(`Attempting to reconnect...`)
setTimeout(() => this.subscribeToEvents(), 1000)