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
765770ef
Unverified
Commit
765770ef
authored
Sep 20, 2023
by
Michael Yang
Committed by
GitHub
Sep 20, 2023
Browse files
Merge pull request #562 from jmorganca/mxyng/fix-ollama-host
fix OLLAMA_HOST parsing for ip6
parents
ee4fd16f
9297ff83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
17 deletions
+8
-17
cmd/cmd.go
cmd/cmd.go
+8
-17
No files found.
cmd/cmd.go
View file @
765770ef
...
...
@@ -655,28 +655,19 @@ func generateBatch(cmd *cobra.Command, model string) error {
}
func
RunServer
(
cmd
*
cobra
.
Command
,
_
[]
string
)
error
{
host
,
port
:=
"127.0.0.1"
,
"11434"
parts
:=
strings
.
Split
(
os
.
Getenv
(
"OLLAMA_HOST"
),
":"
)
if
ip
:=
net
.
ParseIP
(
parts
[
0
]);
ip
!=
nil
{
host
=
ip
.
String
()
}
if
len
(
parts
)
>
1
{
port
=
parts
[
1
]
}
// deprecated: include port in OLLAMA_HOST
if
p
:=
os
.
Getenv
(
"OLLAMA_PORT"
);
p
!=
""
{
port
=
p
host
,
port
,
err
:=
net
.
SplitHostPort
(
os
.
Getenv
(
"OLLAMA_HOST"
))
if
err
!=
nil
{
host
,
port
=
"127.0.0.1"
,
"11434"
if
ip
:=
net
.
ParseIP
(
os
.
Getenv
(
"OLLAMA_HOST"
));
ip
!=
nil
{
host
=
ip
.
String
()
}
}
err
:=
initializeKeypair
()
if
err
!=
nil
{
if
err
:=
initializeKeypair
();
err
!=
nil
{
return
err
}
ln
,
err
:=
net
.
Listen
(
"tcp"
,
fmt
.
Sprintf
(
"%s:%s"
,
host
,
port
))
ln
,
err
:=
net
.
Listen
(
"tcp"
,
net
.
JoinHostPort
(
host
,
port
))
if
err
!=
nil
{
return
err
}
...
...
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