This is a chat bot built with React.js, Node.js and Express.js, integrated with OpenAI's API to provide natural language processing capabilities. The bot can engage in conversations with users, answer questions, and provide responses based on the context of the conversation.
- Natural Language Processing (NLP) using OpenAI's API.
- Interactive conversations with users.
- Ability to answer questions and provide context-aware responses.
- Fully customizable/tweakable
- Clone the repository:
git clone https://github.com/tyleroneil72/react-chat-bot.git
cd react-chat-bot
- Install dependencies:
npm install
- Obtain OpenAI API Key:
Sign up for an account at OpenAI. Get your API key from the OpenAI dashboard. Create a .env file in the root directory and add your API key:
API_KEY='YOUR KEY HERE'
# You may need to change this depending on your accounts access, gpt 3.5 is available to all accounts
MODEL='gpt-4'
# MODEL='gpt-3.5-turbo-1106' This model is soon to be deprecated
# MODEL='gpt-3.5-turbo'
# If you change this express port, it also must be changed in frontend/src/chat/Chat.jsx EXPRESS_PORT variable
EXPRESS_PORT='3000'
VITE_PORT='5173'
const gptModel = process.env.MODEL;
const response = await openai.createChatCompletion({
model: gptModel,
messages: messages,
});
NOTE: Works best with GPT-4
Run the following command from the root directory
npm start
Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
This project was inspired by the capabilities of OpenAI's API.
This project was originally crafted without the use of React. If you're curious to explore its earlier version, you can find the legacy repository by clicking here
For any inquiries or questions, you can reach me at tyleroneildev@gmail.com or on my linkedin at https://ca.linkedin.com/in/tyler-oneil-dev