Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
orangecat
ollama
Commits
407a5cab
"git@developer.sourcefind.cn:wangsen/mineru.git" did not exist on "b18496b0ae846fe9f1299d9f4e6ab72a5609daec"
Commit
407a5cab
authored
Jul 10, 2023
by
Eva Ho
Browse files
when app is running, server restarts when it exits or disconnects
parent
0859d509
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
app/src/index.ts
app/src/index.ts
+13
-2
No files found.
app/src/index.ts
View file @
407a5cab
...
@@ -40,8 +40,8 @@ const ollama = path.join(process.resourcesPath, 'ollama')
...
@@ -40,8 +40,8 @@ const ollama = path.join(process.resourcesPath, 'ollama')
function
server
()
{
function
server
()
{
const
binary
=
app
.
isPackaged
const
binary
=
app
.
isPackaged
?
path
.
join
(
process
.
resourcesPath
,
'
ollama
'
)
?
path
.
join
(
process
.
resourcesPath
,
'
ollama
'
)
:
path
.
resolve
(
process
.
cwd
(),
'
..
'
,
'
ollama
'
)
:
path
.
resolve
(
process
.
cwd
(),
'
..
'
,
'
ollama
'
)
console
.
log
(
`Starting server`
)
console
.
log
(
`Starting server`
)
const
proc
=
spawn
(
binary
,
[
'
serve
'
])
const
proc
=
spawn
(
binary
,
[
'
serve
'
])
...
@@ -52,11 +52,22 @@ function server() {
...
@@ -52,11 +52,22 @@ function server() {
console
.
error
(
`server:
${
data
}
`
)
console
.
error
(
`server:
${
data
}
`
)
})
})
proc
.
on
(
'
exit
'
,
()
=>
{
console
.
log
(
'
Restarting...
'
);
server
();
})
proc
.
on
(
'
disconnect
'
,
()
=>
{
console
.
log
(
'
Restarting...
'
);
server
();
})
process
.
on
(
'
exit
'
,
()
=>
{
process
.
on
(
'
exit
'
,
()
=>
{
proc
.
kill
()
proc
.
kill
()
})
})
}
}
function
installCLI
()
{
function
installCLI
()
{
const
symlinkPath
=
'
/usr/local/bin/ollama
'
const
symlinkPath
=
'
/usr/local/bin/ollama
'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment