Transform any document, video, or audio file into an intelligent, conversational knowledge base using RAG (Retrieval Augmented Generation) and OpenAI.
Imagine having a super-smart assistant that has read all your documents, watched your videos, and listened to your audio files - and can answer questions about them instantly. That's exactly what this app does!
In Simple Terms:
- 📤 Upload any file (PDFs, videos, audio, images, etc.)
- 🤖 Ask questions in plain English
- 💬 Get accurate answers based on your uploaded content
It's like ChatGPT, but it actually knows about YOUR specific documents and content.
Upload virtually anything:
- 📄 Documents: PDFs, Word, Excel, PowerPoint, Text files
- 🖼️ Images: PNG, JPG, TIFF, and more
- 🎬 Videos: MP4, AVI, MOV
- 🎵 Audio: MP3, WAV
- 📧 Emails: EML, MSG
🤖 LLM Mode - Get natural, conversational answers
- AI reads your documents and gives you clear, helpful responses
- Choose from GPT-5, GPT-4.1, or lightweight models
- Customize how the AI responds with system prompts
📊 Raw Retrieval Mode - See exactly what was found
- View the exact chunks of text the AI found
- See relevance scores for each piece
- Perfect for fact-checking and research
- Custom System Prompts: Tell the AI how to respond (e.g., "respond in bullet points", "be concise", "act like an expert")
- Metadata Tagging: Organize documents with custom tags and filters
- Partition Support: Group documents into categories
- View Document Chunks: See exactly how your files were processed
- Smart Processing: Different modes for text extraction vs. image/table extraction
- Node.js (version 18 or higher) - Download here
- Ragie API Key - Get one free at ragie.ai
- OpenAI API Key - Get one at openai.com
Step 1: Get the Code
git clone https://github.com/YOUR_USERNAME/ragie-chat-app.git
cd ragie-chat-appStep 2: Add Your API Keys
- Find the file called
.envin the main folder - Open it and replace the placeholder text:
RAGIE_API_KEY=your_actual_ragie_key_here OPENAI_API_KEY=your_actual_openai_key_here PORT=3001
Step 3: Install & Run
# Install everything (only needed once)
npm install
# Install backend
cd backend && npm install && cd ..
# Install frontend
cd frontend && npm install && cd ..
# Start the app
npm startStep 4: Open Your Browser
Go to: http://localhost:3002
That's it! 🎉
- Click the 📤 Upload tab
- Click the pretty upload box and select a file
- Choose processing mode:
- Fast: Quick text extraction (good for most documents)
- Hi-res: Extracts images and tables (slower, great for PDFs with visuals)
- All: Processes audio and video too
- (Optional) Add metadata tags like
category: training,year: 2024 - Click Upload Document
- Click the 💬 Chat tab
- Toggle 🤖 LLM Mode ON for AI answers
- Select your preferred AI model (GPT-4.1 Mini is recommended)
- (Optional) Click ⚙️ System Prompt to customize AI behavior
- Type your question and press Send!
- Click the 📚 Documents tab
- See all uploaded documents with their status
- Click View Details to see metadata
- Click 🔍 View All Chunks to see how the document was processed
- Delete documents you no longer need
| Mode | Best For | What It Does | Speed |
|---|---|---|---|
| Fast | Text documents, emails | Extracts text only | ⚡ Very Fast |
| Hi-res | PDFs with images/tables | Extracts text, images, and tables | 🐌 Slow (20x slower) |
| All | Videos, audio, all media | Processes everything including audio/video | 🕐 Varies |
Your document goes through these stages:
pending → partitioning → partitioned → refined → chunked → indexed → ready ✅
- indexed: Ready for basic chat
- ready: Fully processed with summaries
When you upload a document, it gets split into smaller pieces called "chunks". Think of it like cutting a book into paragraphs - this helps the AI find relevant information quickly.
When you ask a question, the AI:
- Searches through all chunks
- Finds the most relevant ones
- Uses them to answer your question
For Developers (Click to expand)
Frontend:
- React 18 with Hooks
- Vite for blazing-fast development
- Axios for API communication
- LocalStorage for persistent settings
Backend:
- Node.js + Express
- OpenAI SDK (Responses API)
- Ragie SDK for document processing
- Multer for file uploads
-
Document Ingestion (Ragie)
- Upload → Ragie API
- Automatic chunking, embedding, and indexing
- Supports multiple processing strategies
-
Retrieval (Ragie)
- User query → Ragie retrieval API
- Returns top-K most relevant chunks with scores
-
Augmented Generation (OpenAI)
- System prompt + retrieved chunks + user query → OpenAI
- Uses OpenAI Responses API
- Returns natural language answer + source chunks
Backend (Port 3001):
POST /api/documents/upload- Upload filesGET /api/documents- List documentsGET /api/documents/:id- Get document detailsGET /api/documents/:id/chunks- View document chunksDELETE /api/documents/:id- Delete documentPOST /api/retrievals- Raw retrieval (chunks only)POST /api/chat- RAG chat (LLM answers)
Frontend (Port 3002):
- React SPA with three main views
- Real-time updates via React state management
ragie-chat-app/
├── backend/
│ ├── server.js # Express server + API routes
│ └── package.json
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ │ ├── FileUpload.jsx # Upload interface
│ │ │ ├── DocumentList.jsx # Document management
│ │ │ └── Chat.jsx # Chat interface
│ │ ├── App.jsx
│ │ └── main.jsx
│ └── package.json
├── .env # API keys (DO NOT COMMIT)
├── .gitignore
└── README.md
For Businesses:
- 📊 Analyze reports and presentations instantly
- 📧 Search through emails and documents
- 🎓 Create a searchable knowledge base
- 📹 Extract insights from meeting recordings
For Students:
- 📚 Study from lecture recordings
- 📝 Get summaries of research papers
- 🎥 Extract notes from video lectures
- 📖 Search across all your course materials
For Content Creators:
- 🎬 Transcribe and search video content
- 🎙️ Extract insights from podcasts
- 📄 Organize research materials
- ✍️ Find specific quotes and references
- ✅ All data is processed through Ragie's secure API
- ✅ API keys stored in
.env(never committed to git) - ✅ No data is stored by this application (only in Ragie)
- ✅ You can delete documents anytime
Note: Review Ragie and OpenAI's privacy policies before uploading sensitive information.
"OpenAI API key not configured"
- Check that your
.envfile hasOPENAI_API_KEY=your_key - Restart the server after adding the key
"Failed to load chunks"
- Wait for document status to be
indexedorready - Refresh the documents tab
Upload fails for video/audio
- Make sure you're using "All" processing mode
- Videos/audio can't use "Fast" or "Hi-res" modes
Port already in use
- Change
PORT=3001in.envto another number - Update
vite.config.jsproxy target to match
Contributions are welcome! This project was built to be educational and extensible.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - feel free to use this for personal or commercial projects!
- Ragie - For the amazing RAG infrastructure
- OpenAI - For the GPT models
- Claude AI - For helping build this project
Built with ❤️ for the AI community
Star ⭐ this repo if you find it useful!