This project is a Flask-based API application that handles document uploads, user management, chat functionalities, and integration with MongoDB for storing reports, documents, and chat history. The app allows users to register, login, upload PDFs, query documents, and interact with a bot via chat.
- User registration with validation for type, name, password, and email.
- Login functionality with email, password, and user type validation.
- Upload PDF files and store them in a specific directory.
- Create and manage reports linked to uploaded PDFs.
- Fetch documents and reports by user email.
- Users can create new chat rooms or interact with existing rooms.
- Bot integration for answering user queries related to documents.
- Chat history storage and retrieval for user queries.
- Python 3.9+
- Flask
- Flask-CORS
- PyMongo
- Python-dotenv
- MongoDB instance (for data storage)
git clone https://github.com/Chiyan200/rag-chat-bot.git
cd rag-chat-bot
Create a virtual environment and install required dependencies:
python3 -m venv venv
-
Activate the virtual environment: On macOS/Linux
source venv/bin/activate
On On Windows
source venv\Scripts\activate
Install dependencies
pip install -r requirements.txt
Create a .env file in the root directory of the project and add the following environment variables:
MONGO_DB_URI=<your_mongo_db_uri>
DB_NAME=<your_database_name>
REPORT_COLLECTION=<your_report_collection>
USER_COLLECTION=<your_user_collection>
DOCUMENT_COLLECTION=<your_document_collection>
CHAT_COLLECTION=<your_chat_collection>
Run the Flask application using the following command:
python app.py