File size: 2,513 Bytes
a8c436a
deb090d
a8c436a
 
deb090d
a8c436a
3d51b03
a8c436a
 
deb090d
 
 
 
 
 
 
 
 
 
 
 
 
 
45e068b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0a7909d
45e068b
0a7909d
 
 
 
 
 
 
45e068b
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
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