--- title: CA Study Assistant emoji: 📚 colorFrom: blue colorTo: purple sdk: docker app_port: 7860 --- # CA Study Assistant This is a full-stack AI-powered study assistant for Chartered Accountant students. - **Frontend**: React - **Backend**: FastAPI - **Deployment**: Docker on Hugging Face Spaces ## How it Works The application is containerized using Docker and orchestrated with Docker Compose. - The **frontend** is a React app served by Nginx. - The **backend** is a FastAPI server running with Uvicorn. - Nginx acts as a reverse proxy, forwarding API requests from the frontend to the backend. ## 🚀 Quick Setup ### 1. Environment Configuration ```bash # Copy the example environment file cp env.example .env # Edit .env with your API keys nano .env ``` Required environment variables: - `GOOGLE_API_KEY`: Get from [Google AI Studio](https://aistudio.google.com/app/apikey) - `QDRANT_URL`: Your Qdrant cloud cluster URL - `QDRANT_API_KEY`: Your Qdrant cloud API key ### 2. Run System Diagnostic ```bash cd backend python diagnostic.py ``` This will check all dependencies and configurations. ### 3. Start the Application ```bash # Using Docker (recommended) docker-compose up --build # Or run locally cd backend && python backend_api.py cd frontend && npm start ``` ## 🔧 Troubleshooting File Uploads If file uploads aren't working, check: 1. **Environment Variables**: Ensure all required vars are set 2. **API Connectivity**: Backend must connect to Qdrant and Google APIs 3. **File Size**: Large files (>10MB) may timeout 4. **File Format**: Only PDF, DOCX, and TXT are supported 5. **Server Status**: Check browser console and server logs ### Common Upload Errors: | Error | Cause | Solution | |-------|-------|----------| | Network Error | Server not running | Start backend server | | 500 Server Error | Missing API keys | Check environment variables | | 413 File Too Large | File exceeds 100MB limit | Use files smaller than 100MB | | 415 Unsupported Type | Wrong file format | Use PDF/DOCX/TXT only | | Timeout | Large file/slow connection | Wait longer or use smaller files | ### File Upload Limits: - **Maximum file size**: 100MB per file - **Supported formats**: PDF, DOCX, TXT - **Recommended size**: Under 10MB for faster processing - **Multiple files**: Can upload multiple files simultaneously ### Debug Steps: 1. Run `python backend/diagnostic.py` 2. Check browser developer console 3. Check backend server logs 4. Verify network connectivity to external APIs