This project implements a Retrieval-Augmented Generation (RAG) chatbot. It consists of a backend built with Django and a frontend built with React.
The project is organized as follows:
backend/: Contains the Django backend application.core/: Core Django project settings and configurations.chat/: Django app for handling chat functionalities.services/: Contains the core logic for document processing, embedding, and question answering.
frontend/: Contains the React frontend application.components/: React components for the user interface.
docker-compose.yml: Defines the services for running the application using Docker.
Before running the application, ensure you have the following installed:
-
Clone the repository:
git clone <your-repository-url> cd rag-chatbot
-
Build and start the services using Docker Compose:
docker-compose up --build
This command will:
- Build the Docker images for the backend and frontend.
- Start the containers for the backend and frontend.
-
Access the application:
- The frontend will be accessible at
http://localhost:3000. - The backend will be accessible at
http://localhost:8000.
- The frontend will be accessible at
-
Navigate to the
backenddirectory:cd backend -
To run the backend locally without Docker:
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Apply migrations:
python manage.py migrate
-
Run the development server:
python manage.py runserver
-
-
Make changes to the code in the
chatapp, specifically in theservicesdirectory for the core logic.
-
Navigate to the
frontenddirectory:cd frontend -
To run the frontend locally without Docker:
-
Install dependencies:
npm install
-
Start the development server:
npm start
-
-
Make changes to the code in the
srcdirectory, specifically in thecomponentsdirectory for the UI andservicesfor API calls.
- Document Upload: Allows users to upload documents that will be processed by the backend.
- Chat Interface: Provides a user interface for interacting with the chatbot.
- Document Processor: Handles the processing of uploaded documents.
- Embedding Service: Generates embeddings for the documents.
- QA Service: Uses the embeddings to answer user questions.
- The
docker-compose.ymlfile defines the necessary configurations for running the application using Docker. - The
requirements.txtfile in thebackenddirectory lists the Python dependencies for the backend. - The
package.jsonfile in thefrontenddirectory lists the JavaScript dependencies for the frontend.
- Implement more advanced document processing techniques.
- Improve the accuracy of the question-answering system.
- Add more features to the user interface.