This Bash script allows users to interact with OpenAI's ChatGPT language model through the OpenAI API.
Defines a context file for the conversation, creates it if it doesn't exist, loads and saves it, allowing the user to follow the conversation thread with ChatGPT. When the user decides to exit ChatGPT, the script deletes the "chat_context" file to recreate it the next time it is executed.
CONTEXT_FILE="chat_context.txt"
touch "$CONTEXT_FILE"
load_context() {
}
save_context() {
}
rm -f "$CONTEXT_FILE"
- Replace 'your_api_key' with your personal OpenAI API key on the API_KEY line.
- chmod +x gpt.sh.
- Add alias to bashrc or zshrc alias gpt=/root/gpt.sh
- Execute the script in your terminal.
- Interact with the language model by entering text in the terminal.
- To exit the script, type 'exit'.