This is a sample Chatbot application based on the Open AI cookbook example from here. It's been adapted to work as a 2-tier application with a React Front-end and a backend built using Fastify on a Node.js server.
Prerequisites:
- Node 16+
Run the following from both the /client and /server folders:
npm install
First let's start the client which will run on port 3000.
cd client
npm start
Then let's add a .env file under the /server folder which contains the OpenAI API key to talk to OpenAI. If you're not sure how to get one, the app itself will explain how to get this information if you've forgotten to set this. NOTE: This file is explicitly ignored in .gitignore so it won't accidentally be commited and pushed to GitHub. It's for local use only.
.env file example
OPENAI_API_KEY="<PUT YOUR OPEN AI API KEY HERE>"
Then let's start the server which will run on port 3001.
cd server
npm run build
npm start
Once both the client and server are running, http://localhost:4280