From 07c45d6197cb00cb1ce855f5b3557bba9fc08a70 Mon Sep 17 00:00:00 2001 From: zhangyunhao Date: Fri, 9 Aug 2024 06:42:29 +0000 Subject: [PATCH] cmd: print proxy info when OLLAMA_DEBUG is true --- api/client.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/client.go b/api/client.go index bbdf8202..a86c2e37 100644 --- a/api/client.go +++ b/api/client.go @@ -106,6 +106,15 @@ func (c *Client) do(ctx context.Context, method, path string, reqData, respData request.Header.Set("Accept", "application/json") request.Header.Set("User-Agent", fmt.Sprintf("ollama/%s (%s %s) Go/%s", version.Version, runtime.GOARCH, runtime.GOOS, runtime.Version())) + if envconfig.Debug() { + proxy, err := http.ProxyFromEnvironment(request) + if err != nil { + fmt.Println("proxy parse error: " + err.Error()) + } else { + fmt.Println("proxy found: " + proxy.String()) + } + } + respObj, err := c.http.Do(request) if err != nil { return err