Project

AFLON Smart Campus Concierge
I extracted PDF text in the browser with PDF.js and saved overlapping chunks in IndexedDB. At query time, I scored passages by keyword relevance, added adjacent context, and streamed Gemini’s answer.
How it’s built View architectureHow it’s built
AFLON Smart Campus Concierge · Browser-only campus assistant answering from uploaded school PDFs, with voice chat
The Smart Campus Concierge lets staff upload school handbooks and policies and ask questions by text or voice. I built it as a client-side React app in about 1,100 lines: PDF.js extracts text, 4,000-character chunks with 1,000-character overlap are stored in IndexedDB, keyword scoring picks up to 30 passages plus neighbours, and Gemini 2.5 Pro streams the answer. Voice uses the Gemini Live native-audio model.
- chunk size / overlap in characters
- 4,000 / 1,000
- max retrieved chunks per query
- 30
- Gemini models (text, live voice)
- 2
- lines of TS/TSX
- 1,141
Technology and what it does here
- React 19 + TypeScript + Vite
- Single-page chat and document library UI
- pdfjs-dist 4
- Extracts PDF text in the browser
- IndexedDB
- Stores documents and chunks locally
- @google/genai
- GenerateContentStream for answers and live.connect for voice
- Gemini 2.5 Pro
- Text answers grounded in retrieved passages
- Gemini 2.5 Flash native audio
- Real-time voice conversation
- AudioWorklet
- Captures 16 kHz mic PCM, plays 24 kHz responses
Implementation details
- Retrieval scores chunks by keyword hits, keeps top anchors and adds one neighbouring chunk each side for context.
- On stream failure it retries generation once before surfacing an error.
System architecture
The browser ingests campus documents and retrieves relevant passages for Gemini when a student asks a question.
Technologies
- React
- PDF.js
- IndexedDB
- Gemini
