-
Clone the repository by running the following command:
gh repo clone jorgenlt/nodejs-chatgpt
-
Change into the cloned directory:
cd nodejs-chatgpt
-
Install the required dependencies using npm:
npm install
-
Create a new file named
.env
:touch .env
-
Open the
.env
file and add the following line, replacingyour-api-key
with your actual API key from OpenAI:API_KEY=your-api-key
-
Start the application by running the following command:
node index
To create an alias that allows you to open the program using the command gpt, follow these steps:
-
Open
run-chatgpt.sh
in your editor and change directory path to your installation path. -
Open your terminal and navigate to the home directory by running the following command:
cd
-
Edit the configuration file named .zshrc using the nano editor. Enter the following command:
nano .zshrc
or use your desired text editor. -
Within the .zshrc file (example is with the zsh framework), add the following line:
alias gpt="$HOME/nodejs-chatgpt/run-chatgpt.sh"
or your installation path. -
Save the changes to the .zshrc file and exit the editor.
-
Restart your terminal for the changes to take effect.