A full-stack application for uploading and querying PDF manuals using RAG (Retrieval-Augmented Generation) technology.
- Admin Dashboard: Upload PDF manuals with company and product information
- User Interface: Chat with AI assistant to get answers from uploaded manuals
- Real-time Processing: Fast PDF processing and vector search
- Company Management: Organize manuals by company and product
- Frontend: Next.js 14 with TypeScript, Tailwind CSS, and shadcn/ui components
- Backend: FastAPI with Python
- Vector Database: Qdrant for document embeddings
- Database: MongoDB for metadata storage
- AI: NIM AI Support
-
Navigate to the backend directory:
cd Rag_Manual_retrival/backend -
Install Python dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.envfile in the backend directory with:NIM_api_key=nim api key MONGODB_URI=your_mongodb_connection_string MONGODB_DB=datquest MONGODB_COLLECTION=uploads -
Start Qdrant vector database:
docker run -p 6333:6333 qdrant/qdrant
-
Run the backend server:
uvicorn main:app --reload --host 0.0.0.0 --port 8000
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env.localfile in the root directory with:NEXT_PUBLIC_API_URL=http://localhost:8000 -
Run the development server:
npm run dev
-
Open http://localhost:3000 in your browser
- Access at
/admin(use email containing "admin" to login) - Upload PDF manuals with company name, product name, and product code
- View all uploaded manuals and their status
- Monitor system metrics
- Access at
/user(use any other email to login) - Select company and product to load specific manual
- Ask questions about the manual content
- Upload new manuals if needed
POST /upload_pdf/- Upload and process PDFPOST /query/- Query the AI assistantGET /companies/- Get all companiesGET /companies/{company}/models/- Get models for a companyGET /health/- Health check
/- Redirects to login/login- Login page/admin- Admin dashboard/user- User interface
The backend URL can be configured in lib/config.ts or via the NEXT_PUBLIC_API_URL environment variable.
- Backend not responding: Check if the backend server is running on port 8000
- Qdrant connection failed: Ensure Qdrant is running on port 6333
- MongoDB connection failed: Verify your MongoDB connection string
- OpenAI API errors: Check your OpenAI API key and credits
- Frontend errors: The app includes error boundaries and better error handling
- Test backend connection: Run
node test-backend.jsto verify backend connectivity
The application includes comprehensive error handling:
- Error Boundaries: Catch React component errors gracefully
- API Error Handling: Proper error messages for all API calls
- Loading States: Visual feedback during data loading
- Validation: File type and size validation for uploads
- Fallback States: Graceful degradation when services are unavailable
- Frontend: Next.js with TypeScript
- Backend: FastAPI with Python
- Styling: Tailwind CSS with shadcn/ui components
- State Management: React hooks
- API Communication: Fetch API with custom service layer