This project provides a chatbot that interacts with users based on the contents of provided documents. It integrates AI capabilities to understand and respond to user queries using the context of the documents stored in a vector database.
- Natural Language Processing with LangChain and OpenAI
- Efficient document storage and retrieval with Supabase
- React-based front-end with TailwindCSS for styling
- Persistent chat history using local storage
Follow these steps to set up the project locally:
-
Clone the repository:
git clone https://github.com/jacky-xbb/ai-assistant cd chatbot-docs
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root of your project and add your API keys:VITE_SUPABASE_BASE_URL=your-supabase-url VITE_SUPABASE_API_KEY=your-supabase-api-key VITE_OPENAI_API_KEY=your-openai-api-key VITE_OPENAI_BASE_URL=https://api.openai.com/v1
-
Start the development server:
npm run dev
src/
├── components/
│ ├── Avatar.jsx
│ ├── Chat.jsx
│ ├── ChatBox.jsx
│ ├── Header.jsx
│ └── Message.jsx
├── utils/
│ ├── chain.js
│ ├── combineDocuments.js
│ ├── formatConvHistory.js
│ └── retriever.js
├── App.jsx
├── main.jsx
├── index.css
└── custom.css
-
Open your browser: Navigate to
http://localhost:5173
. -
Interact with the chatbot: Type your queries in the chatbox and receive responses based on the context of your documents.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.