BuilderIO / ai-shell

A CLI that converts natural language to shell commands.
MIT License
4.04k stars 257 forks source link

Not compatible with the http_proxy setting #32

Closed icedfish closed 1 year ago

icedfish commented 1 year ago

I use http proxy to speed up visiting to api.openai.com.

shell config command like:

  export http_proxy=<proxy url>
  export https_proxy=<proxy url>

I got the following errors while run ai shell

◒  Loading

✖ Hostname/IP does not match certificate's altnames: Host: api.openai.com. is not in the cert's altnames: DNS:*.<proxy-domain>, DNS:<proxy-domain>
    at new NodeError (node:internal/errors:399:5)
    at Object.checkServerIdentity (node:tls:337:12)
    at TLSSocket.onConnectSecure (node:_tls_wrap:1568:27)
    at TLSSocket.emit (node:events:512:28)
    at TLSSocket._finishInit (node:_tls_wrap:977:8)
    at ssl.onhandshakedone (node:_tls_wrap:771:12)

    ai-shell v0.1.6

I checked the proxy setting, it is woking well under other shell command, like curl.

$ curl https://api.openai.com/
{
  "error": {
    "message": "Invalid URL (GET /)",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}
icedfish commented 1 year ago

Or setting an OPENAI_API_BASE_URL (for replace https://api.openai.com) option is also ok to me, it should be more easy to develop.

(and it’s also needed to use Azure‘s cloud GPT API)

steve8708 commented 1 year ago

great points, interested in sending a pull request?

steve8708 commented 1 year ago

Should be supported now via https://github.com/BuilderIO/ai-shell/pull/40 in 0.1.12