Closed LaikaSerrano closed 1 year ago
Hi,
Assuming that you have installed curl and jq in your machine, running the install script should work for Ubuntu. You can install curl using sudo apt-get install curl
and jq in the same way.
Once you have curl, you can download and run the install script with this command curl -sS https://raw.githubusercontent.com/0xacx/chatGPT-shell-cli/main/install.sh | sudo -E bash
, which will ask for your OpenAI API key and set it as an environment variable.
If want to install it manually, all you have to do is:
chatgpt.sh
file in a directory you wantchatgpt.sh
to your $PATH. You do that by adding this to your shell profile.export PATH=$PATH:/path/to/chatgpt.sh
. If you use zsh, your shell profile is ~/.zprofile
, if you're using bash it's ~/.profile
in Ubuntu.export OPENAI_TOKEN=your_token_here
Hope that helps!
I am still having the same problem even though i'm installing it manually. I have an error from jq saying "jq: error (at ~/.profile
worked but I cannot have response from the chat.
What prompt are you using? Using "
quotation marks in the prompt can cause this error.
Basically none in the cli and in profile I tried "
and '
but nothing change.
Prompt is the question you ask to chatGPT, you don't need to set it anywhere, you just type it when the script is running, the same way you would do when chatting in https://chat.openai.com/chat
.
I just added the quotation marks escape, so now you can use quotation marks in the prompt.
In your ~/.profile
, it shouldn't matter if you add the export statements with or without quotation marks, it should work both ways.
Try to curl the API from your terminal to see if you get a correct response. Just replace YOUR_TOKEN with your OpenAI token.
curl https://api.openai.com/v1/completions \
-sS \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"model": "text-davinci-003",
"prompt": "How to make an HTTP request in javascript?",
"max_tokens": 1000,
"temperature": 0.7
}'
If that works and you have set your OpenAI key correctly in your shell profile, the script should work.
It works like that. I tried to reinstall everything from the script and it seems working now. I'll come back to you if it doesn't work anymore. Thanks !
Hello ! I've seen your repo and wanted to use it in a Ubuntu Multipass vm but I basically cannot prompt my api key so nothing want to start when I try starting it and there's error. Could you help me ? Thanks :)