yuvrajsingh6
feat: RAG system with OCR for Hugging Face Spaces
4d592a4

RAG System Frontend

React + TypeScript frontend for the Production-Grade RAG System.

Tech Stack

  • Framework: React 18+ with TypeScript
  • Styling: Tailwind CSS
  • State Management: React Context API
  • HTTP Client: Axios
  • File Upload: react-dropzone
  • Icons: lucide-react
  • Notifications: react-hot-toast

Project Structure

src/
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ layout/
β”‚   β”‚   β”œβ”€β”€ Header.tsx
β”‚   β”‚   β”œβ”€β”€ Sidebar.tsx
β”‚   β”‚   └── MainContent.tsx
β”‚   β”œβ”€β”€ documents/
β”‚   β”‚   β”œβ”€β”€ FileUpload.tsx
β”‚   β”‚   β”œβ”€β”€ DocumentList.tsx
β”‚   β”‚   └── DocumentCard.tsx
β”‚   β”œβ”€β”€ query/
β”‚   β”‚   β”œβ”€β”€ QueryInput.tsx
β”‚   β”‚   └── ModeSelector.tsx
β”‚   β”œβ”€β”€ results/
β”‚   β”‚   β”œβ”€β”€ ResultsDisplay.tsx
β”‚   β”‚   β”œβ”€β”€ AnswerCard.tsx
β”‚   β”‚   β”œβ”€β”€ ConfidenceIndicator.tsx
β”‚   β”‚   β”œβ”€β”€ SourcesList.tsx
β”‚   β”‚   └── SourceCard.tsx
β”‚   β”œβ”€β”€ common/
β”‚   β”‚   └── EmptyState.tsx
β”‚   └── settings/
β”‚       └── SettingsModal.tsx
β”œβ”€β”€ services/
β”‚   └── api.ts
β”œβ”€β”€ hooks/
β”œβ”€β”€ context/
β”‚   └── AppContext.tsx
β”œβ”€β”€ types/
β”‚   └── index.ts
β”œβ”€β”€ App.tsx
└── index.tsx

Installation

npm install

Development

npm run dev

Build

npm run build

Configuration

Copy .env.example to .env and configure:

VITE_API_URL=http://localhost:8000/api/v1

Features

  • PDF document upload with drag-and-drop
  • Document management (list, select, delete)
  • Multiple query modes (Web, PDF, Hybrid, Restricted)
  • Real-time confidence scoring
  • Source citations and attribution
  • Dark/light theme
  • Responsive design
  • Keyboard shortcuts (Enter to submit)