when app is running, server restarts when it exits or disconnects
This commit is contained in:
parent
0859d50942
commit
407a5cabf4
1 changed files with 13 additions and 2 deletions
|
@ -40,8 +40,8 @@ const ollama = path.join(process.resourcesPath, 'ollama')
|
|||
|
||||
function server() {
|
||||
const binary = app.isPackaged
|
||||
? path.join(process.resourcesPath, 'ollama')
|
||||
: path.resolve(process.cwd(), '..', 'ollama')
|
||||
? path.join(process.resourcesPath, 'ollama')
|
||||
: path.resolve(process.cwd(), '..', 'ollama')
|
||||
|
||||
console.log(`Starting server`)
|
||||
const proc = spawn(binary, ['serve'])
|
||||
|
@ -52,11 +52,22 @@ function server() {
|
|||
console.error(`server: ${data}`)
|
||||
})
|
||||
|
||||
proc.on('exit', () => {
|
||||
console.log('Restarting...');
|
||||
server();
|
||||
})
|
||||
|
||||
proc.on('disconnect', () => {
|
||||
console.log('Restarting...');
|
||||
server();
|
||||
})
|
||||
|
||||
process.on('exit', () => {
|
||||
proc.kill()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function installCLI() {
|
||||
const symlinkPath = '/usr/local/bin/ollama'
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue