From 459f4a7889f4acf30ef2542287becf2308ff51ef Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Fri, 20 Oct 2023 11:32:28 -0700 Subject: [PATCH] fix: ollama host for hostname --- api/client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/client.go b/api/client.go index 14ea353d..3cf55a25 100644 --- a/api/client.go +++ b/api/client.go @@ -52,8 +52,10 @@ func ClientFromEnvironment() (*Client, error) { host, port, err := net.SplitHostPort(hostport) if err != nil { 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() + } else if hostport != "" { + host = hostport } }