This is a simple AI-powered chatbot that uses OpenAI's API. It includes a backend built with Node.js & Express and a frontend using HTML, JavaScript, and NGINX.
Before running the app locally, ensure you have the following installed:
- Docker (with Docker Compose)
git clone <repo-url>
cd ai-agent- Create a
.envfile in the root directory (ai-agent/). - Add the following environment variables:
OPENAI_API_KEY=your_openai_api_key_here
API_URL=http://localhost:3000/api/chatdocker compose up -d --build- Backend runs at
http://localhost:3000 - Frontend runs at
http://localhost:5500
- Open
http://localhost:5500/in a browser. - Enter a message in the chatbot interface.
- The chatbot will respond using OpenAI's API.
- Backend not responding? Check Docker container logs with
docker logs backend_service. - CORS issue? Ensure Docker services are running and API URLs are correctly set in the
.env. - API key error? Ensure your OpenAI API key is correctly set in
.env.
This project is open-source. Feel free to modify and improve it!