mirror of
https://github.com/0xacx/chatGPT-shell-cli.git
synced 2024-11-24 11:25:31 +00:00
Compare commits
6 Commits
670bad8408
...
5d8dcb6ae5
Author | SHA1 | Date | |
---|---|---|---|
|
5d8dcb6ae5 | ||
|
b0400fc4ca | ||
|
cf45c6010c | ||
|
b4bbb56f27 | ||
|
f11493c0a6 | ||
|
7a7434ffa0 |
@ -10,6 +10,7 @@ The script uses the `completions` endpoint and the `text-davinci-003` model for
|
||||
- Chat with GPT from the terminal
|
||||
- Generate images from a text prompt
|
||||
- View your chat history
|
||||
- List all available OpenAI models
|
||||
|
||||
![Screenshot 2023-01-12 at 13 59 08](https://user-images.githubusercontent.com/99351112/212061157-bc92e221-ad29-46b7-a0a8-c2735a09449d.png)
|
||||
|
||||
@ -41,7 +42,7 @@ This script relies on curl for the requests to the api and jq to parse the json
|
||||
|
||||
### Manual Installation
|
||||
|
||||
If want to install it manually, all you have to do is:
|
||||
If you want to install it manually, all you have to do is:
|
||||
|
||||
- Download the `chatgpt.sh` file in a directory you want
|
||||
- Add the path of `chatgpt.sh` to your `$PATH`. You do that by adding this line to your shell profile: `export PATH=$PATH:/path/to/chatgpt.sh`
|
||||
@ -54,4 +55,6 @@ This script relies on curl for the requests to the api and jq to parse the json
|
||||
- To generate images, start a prompt with `image:`
|
||||
If you are using iTerm, you can view the image directly in the terminal. Otherwise the script will ask to open the image in your browser.
|
||||
- To view your chat history, type `history`
|
||||
- To get a list of the models available at OpenAI API, type `models`
|
||||
- To view all the information on a specific model, use `model:` and the model `id` as it appears in the list of models. For example: `model:text-babbage:001` will get you all the fields for `text-babbage:001` model
|
||||
|
||||
|
14
chatgpt.sh
14
chatgpt.sh
@ -52,6 +52,20 @@ while $running; do
|
||||
fi
|
||||
elif [[ "$prompt" == "history" ]]; then
|
||||
echo -e "\n$(cat ~/.chatgpt_history)"
|
||||
elif [[ "$prompt" == "models" ]]; then
|
||||
models_response=$(curl https://api.openai.com/v1/models \
|
||||
-sS \
|
||||
-H "Authorization: Bearer $OPENAI_KEY")
|
||||
handleError "$models_response"
|
||||
models_data=$(echo $models_response | jq -r -C '.data[] | {id, owned_by, created}')
|
||||
echo -e "\n\033[36mchatgpt \033[0m This is a list of models currently available at OpenAI API:\n ${models_data}"
|
||||
elif [[ "$prompt" =~ ^model: ]]; then
|
||||
models_response=$(curl https://api.openai.com/v1/models \
|
||||
-sS \
|
||||
-H "Authorization: Bearer $OPENAI_KEY")
|
||||
handleError "$models_response"
|
||||
model_data=$(echo $models_response | jq -r -C '.data[] | select(.id=="'"${prompt#*model:}"'")')
|
||||
echo -e "\n\033[36mchatgpt \033[0m Complete data for model: ${prompt#*model:}\n ${model_data}"
|
||||
else
|
||||
# escape quotation marks
|
||||
escaped_prompt=$(echo "$prompt" | sed 's/"/\\"/g')
|
||||
|
Loading…
Reference in New Issue
Block a user