A RAG (Retrieval-Augmented Generation) application that allows you to chat with documents from a local directory using Google's Gemini AI.
This app consists of:
- Frontend: React + TypeScript (Vite) running on port 3000
- Backend: Express server running on port 3001 that handles Gemini API calls and reads local documents
- Node.js (v18 or higher)
- A Gemini API key from Google AI Studio
Install frontend dependencies:
npm installInstall backend dependencies:
cd server
npm install
cd ..Edit server/.env and set:
GEMINI_API_KEY: Your Gemini API keyDOCUMENTS_DIR: Path to your documents directory (default:/Users/aneal/Library/CloudStorage/OneDrive-UniversityofEdinburgh/national_security_analysis/gemini_PDF_processor/output/clean_final)
Example:
GEMINI_API_KEY=your_actual_api_key_here
DOCUMENTS_DIR=/path/to/your/documents
PORT=3001You need to run both the backend and frontend:
Terminal 1 - Backend:
cd server
npm run devTerminal 2 - Frontend:
npm run devThe app will be available at http://localhost:3000
- First startup: The app automatically loads all documents from the configured directory and creates a persistent RAG store (5-10 minutes for 607 documents)
- Subsequent startups: The app uses the cached RAG store and loads instantly (2-3 seconds)
- You can chat with the documents - the AI will search through them to answer your questions
- Clear Chat button: Clears the conversation history but keeps the documents loaded
- Reload button: Forces re-upload of all documents from the directory (use this if you add new documents to the folder)
.txt- Plain text.pdf- PDF documents.doc,.docx- Word documents.md- Markdown.html- HTML files.json- JSON files