jschuur / chatgpt-repl

Interactive CLI for ChatGPT
https://npmjs.com/package/chatgpt-repl
13 stars 0 forks source link

BUG: `openai.createChatCompletion` caught errors don't always show #6

Closed jschuur closed 1 year ago

jschuur commented 1 year ago

The try/catch doesn't seem to show all non-401 status code errors. It hits the catch block, but ignore this part, leading to a confusing blank response when there's an issue with the openai.createChatCompletion payload.

https://github.com/jschuur/chatgpt-repl/blob/8dd438a8b21057c83be80827c56d97c85cc9197e/src/openai.js#L98

Just doing console.error(error) at the top of the catch block shows the error though.

mmower commented 1 year ago
➜  gpt chatgpt-repl
┌  Interact with ChatGPT (max tokens: 1024, history: 3, temp: 1, model: gpt-3.5-turbo)
│
◇  Prompt? (Ctrl-C or enter to exit)
│  write a javascript function to sum two arguments
│
│
◇  Response in 503ms. unknown
│
◆  Prompt? (Ctrl-C or enter to exit)
│  _
└
mmower commented 1 year ago
➜  gpt chatgpt-repl -v
ChatGPT REPL v0.0.8
➜  gpt

I used npm install as you suggested.

mmower commented 1 year ago

Okay i've updated nodejs, npm and everything else and now have v0.0.9 of chatgpt-repl.

mmower commented 1 year ago

However, the result is the same:

Response in 1.8s. unknown
jschuur commented 1 year ago

I've changed the error capturing and rendering in 0.1.0. Could you update it and see what error you get now, @mmower?

Technically, issue #8 covers your problem. This one was about how error messages weren't being displayed, so I'll close this one based on 0.1.0's update.