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
OpenDAS
ollama
Commits
36d6081e
"vscode:/vscode.git/clone" did not exist on "d36b3c63d9e62eaba70b66d634eadaa56d85c362"
Commit
36d6081e
authored
Jul 31, 2023
by
Bruce MacDonald
Browse files
find symlink of mac app
parent
e72fe794
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
22 deletions
+31
-22
cmd/cmd.go
cmd/cmd.go
+31
-22
No files found.
cmd/cmd.go
View file @
36d6081e
...
@@ -526,14 +526,13 @@ func RunServer(_ *cobra.Command, _ []string) error {
...
@@ -526,14 +526,13 @@ func RunServer(_ *cobra.Command, _ []string) error {
return
server
.
Serve
(
ln
)
return
server
.
Serve
(
ln
)
}
}
func
checkServerHeartbeat
(
_
*
cobra
.
Command
,
_
[]
string
)
error
{
func
startMacApp
(
client
*
api
.
Client
)
error
{
client
:=
api
.
NewClient
()
link
,
err
:=
os
.
Readlink
(
"/usr/local/bin/ollama"
)
if
err
:=
client
.
Heartbeat
(
context
.
Background
());
err
!=
nil
{
if
err
!=
nil
{
if
strings
.
Contains
(
err
.
Error
(),
"connection refused"
)
{
return
err
if
runtime
.
GOOS
==
"darwin"
{
}
// if the mac app is available, start it
path
:=
strings
.
Split
(
link
,
"Ollama.app"
)
if
_
,
err
:=
os
.
Stat
(
"/Applications/Ollama.app"
);
err
==
nil
{
if
err
:=
exec
.
Command
(
"/usr/bin/open"
,
"-a"
,
path
[
0
]
+
"Ollama.app"
)
.
Run
();
err
!=
nil
{
if
err
:=
exec
.
Command
(
"/usr/bin/open"
,
"-a"
,
"/Applications/Ollama.app"
)
.
Run
();
err
!=
nil
{
return
err
return
err
}
}
// wait for the server to start
// wait for the server to start
...
@@ -549,11 +548,21 @@ func checkServerHeartbeat(_ *cobra.Command, _ []string) error {
...
@@ -549,11 +548,21 @@ func checkServerHeartbeat(_ *cobra.Command, _ []string) error {
}
}
}
}
}
}
}
func
checkServerHeartbeat
(
_
*
cobra
.
Command
,
_
[]
string
)
error
{
client
:=
api
.
NewClient
()
if
err
:=
client
.
Heartbeat
(
context
.
Background
());
err
!=
nil
{
if
!
strings
.
Contains
(
err
.
Error
(),
"connection refused"
)
{
return
err
}
}
if
runtime
.
GOOS
==
"darwin"
{
if
err
:=
startMacApp
(
client
);
err
!=
nil
{
return
fmt
.
Errorf
(
"could not connect to ollama app server, run 'ollama serve' to start it"
)
}
}
}
else
{
return
fmt
.
Errorf
(
"could not connect to ollama server, run 'ollama serve' to start it"
)
return
fmt
.
Errorf
(
"could not connect to ollama server, run 'ollama serve' to start it"
)
}
}
return
err
}
}
return
nil
return
nil
}
}
...
...
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