This is a simple chatbot application that uses the OpenAI GPT-3 model to generate responses.
The project is organized into several JavaScript files:
chatbot.js
: Contains the main chatbot functionality, including sending requests to the OpenAI API and handling user input.openai-service.js
: Handles communication with the OpenAI API.io-utils.js
: Contains utility functions for saving the conversation to a file.main.js
: The entry point of the application.openai-config.js
: Contains the OpenAI API key.
- Clone the repository.
- Run
npm install
to install the dependencies. - Create
.env
file in project root directory and addOPENAI_API_KEY=your_api_key
- Run
node src/main.js
to start the chatbot. - Type your message and press enter to get a response.
- Type 'exit' to end the conversation. The conversation will be saved to a file in the
conversations
directory.
- chalk: Terminal string styling done right.
- openai: Official OpenAI API client library for JavaScript.
This project is licensed under the ISC license.