Unverified Commit 533d7636 authored by Michael Yang's avatar Michael Yang Committed by GitHub
Browse files

Merge pull request #859 from jmorganca/mxyng/fix-hostname

fix: ollama host for hostname
parents cbfff4f8 459f4a78
...@@ -52,8 +52,10 @@ func ClientFromEnvironment() (*Client, error) { ...@@ -52,8 +52,10 @@ func ClientFromEnvironment() (*Client, error) {
host, port, err := net.SplitHostPort(hostport) host, port, err := net.SplitHostPort(hostport)
if err != nil { if err != nil {
host, port = "127.0.0.1", "11434" host, port = "127.0.0.1", "11434"
if ip := net.ParseIP(strings.Trim(os.Getenv("OLLAMA_HOST"), "[]")); ip != nil { if ip := net.ParseIP(strings.Trim(hostport, "[]")); ip != nil {
host = ip.String() host = ip.String()
} else if hostport != "" {
host = hostport
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment