BuilderIO / ai-shell

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

Error on using ai-shell #18

Closed fhperuchi closed 1 year ago

fhperuchi commented 1 year ago

I am getting this error running on my Mac Studio M1 (arm64). I have set my OPENAI_KEY properly with the command: ai-shell config set OPENAI_KEY=<your token>

Versions:

$ node -v
v14.21.3
$ npm -v
9.6.4
$ ai-shell --version
0.0.17
$ ai 'what is my ip address'                    

┌   ai-shell 
│
◐  Loading   
(node:6025) UnhandledPromiseRejectionWarning: Error: Request failed with status code 429
    at createError (/Users/fhperuchi/.nvm/versions/node/v14.21.3/lib/node_modules/@builder.io/ai-shell/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/Users/fhperuchi/.nvm/versions/node/v14.21.3/lib/node_modules/@builder.io/ai-shell/node_modules/axios/lib/core/settle.js:17:12)
    at RedirectableRequest.handleResponse (/Users/fhperuchi/.nvm/versions/node/v14.21.3/lib/node_modules/@builder.io/ai-shell/node_modules/axios/lib/adapters/http.js:278:9)
    at RedirectableRequest.emit (events.js:400:28)
    at RedirectableRequest._processResponse (/Users/fhperuchi/.nvm/versions/node/v14.21.3/lib/node_modules/@builder.io/ai-shell/node_modules/follow-redirects/index.js:356:10)
    at ClientRequest.RedirectableRequest._onNativeResponse (/Users/fhperuchi/.nvm/versions/node/v14.21.3/lib/node_modules/@builder.io/ai-shell/node_modules/follow-redirects/index.js:62:10)
    at Object.onceWrapper (events.js:520:26)
    at ClientRequest.emit (events.js:400:28)
    at HTTPParser.parserOnIncomingClient (_http_client.js:647:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:127:17)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6025) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:6025) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit co ◑  Loading... 

It got stucked at this last line.

ZeldOcarina commented 1 year ago

This is the same as #13. I think there's an ARM M1 bug here, we are on the same system.

ZeldOcarina commented 1 year ago

Proposed fix in #20

soumilroy commented 1 year ago

@ZeldOcarina Your fix worked. Thanks a lot.