瀏覽代碼

fix: ollama host for hostname

Michael Yang 1 年之前
父節點
當前提交
459f4a7889
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      api/client.go

+ 3 - 1
api/client.go

@@ -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
 		}
 		}
 	}
 	}