mattvr/ShellGPT

After updating to latest 0.3.8, gpt command doesn't return any response

Closed this issue ยท 6 comments

I upgraded ShellGPT to the latest version just now, and now when running gpt "<anything here>" I just get an empty response. gpt "tell me a joke" just, nothing. I also uninstalled and re-installed, as well as made sure deno is at latest version. Any guidelines to perhaps get some logs to debug the issue?

Hi @soderluk, here's a few suggestions:

  • what does which gpt return on your machine?
  • what does echo $PATH print on your machine?

For example in my Mac, there's a gpt command that comes with the computer, so if I don't properly set the PATH to include ShellGPT's gpt binary, my terminal runs the default system one, which is a completely different thing

Alternatively, try running cloning the repo and running it this way:

deno run -A mod.ts (see #20)

That command is essentially what gpt runs under the hood

If that works, you could create your own script:

#!/bin/sh
# ~/.bin/gpt
deno run -A path/to/your/cloned/repo/mod.ts

Then put it in ~/.bin/gpt and include it in your PATH: export PATH=~/.bin/:$PATH and make it executable: chmod +x ~/.bin/gpt

At this point running which gpt should print ~/.bin/gpt

Hope that helps

One other thing to try could be resetting your config file

mv ~/.gpt/config.json ~/.gpt/config.bak.json # Back up config
gpt --help # Verify gpt command works, trigger setup
gpt "tell me a joke" 

I've checked that the command really being run is the correct gpt command, everything is good in ${PATH} -> /home/user/.deno/bin, and which gpt -> /home/user/.deno/bin/gpt.
I removed the config and re-run gpt, but still nothing. The config file:
{"lastUpdated":"2024-03-12T07:02:13.797Z","version":"0.3.8","autoUpdate":"prompt","latestName":"2024-03-12_09-07-54","model":"gpt-3.5-turbo"}.

Running the module straight from the repo root, using --debug:

deno run -A mod.ts --debug "tell me a joke"
Request to OpenAI {
  model: "gpt-3.5-turbo",
  messages: [ { role: "user", content: "tell me a joke" } ]
}

And the answer, an empty line in the cli. I'm so confused now. I'll try to checkout the old version and see if that broke everything.

OK, I checked out the older version, and again, same issue, so it seems the issue lies somewhere else. Wonder if my OPENAI_API_KEY has some limits that are getting hit.

I got to the root cause of this. Debugging the responses, the response from openai, is:

{
    "error": {
        "message": "You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.",
        "type": "insufficient_quota",
        "param": null,
        "code": "insufficient_quota"
    }
}

This is the buffer on line 258 of lib/ai.ts. I'll add a new issue for this, and close this one. Thanks for your input @nicobrenner @mattvr

Thank you for the follow up @soderluk, very glad to know you figured it out. I had the same issue with the gpt api, but I got the error directly in the console when it happened

It must be happening to quite a few people as OpenAI currently changed their billing workflow