- Node.js: Ensure you have Node.js installed on your local machine.
-
Clone the Repository:
git clone https://github.com/Paul-Okello/node-chat.git cd node-chat
-
Create Environment File:
- In the root directory, create a new file named
.env
. - Add your OpenAI API key in the following format:
Replace
OPENAI_API_KEY=YOUR_API_KEY_HERE
YOUR_API_KEY_HERE
with your valid OpenAI API key.
- In the root directory, create a new file named
-
Install Dependencies:
npm install
-
Running the Chatbot:
- Execute the following command in your terminal:
node chat.js
- Execute the following command in your terminal:
-
Chatting with the AI:
- Once the script is running, interact with the chatbot by typing messages following the "You:" prompt.
- To exit the chat, type "exit".
This updated guide provides clear steps to set up and run the chatbot, emphasizing the importance of securely storing the OpenAI API key and interacting with the chatbot seamlessly.