How tengsal/rag works
This repository combines a campus knowledge assistant and administration portal, a Python retrieval/sentiment backend, a separate authentication service, and a career-counselling voice agent. The visible user journey is campus chat through retrieval to an answer; other major capabilities include managing documents and notices, analytics, authentication, and outbound counselling calls. Several links among the frontend, Python API, and voice services are only suggested by the tree, so they are left unverified rather than asserted.
Main entry points: worker.ts Voice worker · auth.service.ts Auth service · auth.routes.ts Auth routes · chat-content.tsx Chat interface
Components 31
Campus Assistant
- Chat interface
src/components/chat-content.tsx - Chat endpoint
src/app/api/chat/route.ts - RAG client
src/lib/rag-api.ts - Admin portal
src/app/admin/page.tsx - Content APIs
src/app/api/documents/route.ts - Campus data models
src/lib/models/index.ts - Analytics endpoint
src/app/api/dashboard/route.ts - Sentiment endpoint
src/app/api/sentiment/route.ts
Retrieval Backend
- Python API
backend/api.py - Retriever entry
main.py - Query parser
backend/retrieval/query_parser.py - Structured retrieval
backend/retrieval/structured_retriever.py - RAG retrieval
backend/retrieval/rag_retriever.py - Sentiment analysis
backend/sentiment/analyzer.py - Sentiment collection
backend/sentiment/collector.py
Authentication
- Auth routes
auth-server/src/routes/auth.routes.ts - Auth controller
auth-server/src/controllers/auth.controller.ts - Auth service
auth-server/src/services/auth.service.ts - User records
auth-server/src/models/user.model.ts - JWT utilities
auth-server/src/utils/jwt.ts - JWT middleware
auth-server/src/middleware/auth.middleware.ts
Voice Counselling
- Call dispatch API
career_counselling_ai_agent/src/server.ts - Voice worker
career_counselling_ai_agent/src/worker.ts - Speech recognition
career_counselling_ai_agent/src/plugins/deepgram.ts - Conversation model
career_counselling_ai_agent/src/plugins/llm.ts - Speech synthesis
career_counselling_ai_agent/src/plugins/tts.ts - Counselling leads
career_counselling_ai_agent/src/models/AdtuLead.ts
Other components
- Campus user
- Call operator
- Google OAuth
- LiveKit calling
Connections 26
- Campus user → Chat interface: asks
- Chat interface → Chat endpoint: submits query
- Chat endpoint → RAG client: requests retrieval
- RAG client → Python API: calls API
- Retriever entry → Structured retrieval: invokes
main.py - Structured retrieval → Query parser: parses queries
backend/retrieval/structured_retriever.py - Python API → RAG retrieval: uses retrieval
- Admin portal → Content APIs: manages content
- Content APIs → Campus data models: reads and writes
src/app/api/documents/route.ts - Analytics endpoint → Campus data models: reads
src/app/api/dashboard/route.ts - Sentiment endpoint → Sentiment analysis: requests analysis
- Sentiment collection → Sentiment analysis: collects for analysis
- Auth routes → Auth controller: routes requests
auth-server/src/routes/auth.routes.ts - Auth controller → Auth service: delegates
auth-server/src/controllers/auth.controller.ts - Auth service → User records: reads and writes
auth-server/src/services/auth.service.ts - Auth service → JWT utilities: generates tokens
auth-server/src/services/auth.service.ts - Auth routes → JWT middleware: protects routes
auth-server/src/routes/auth.routes.ts - JWT middleware → JWT utilities: verifies tokens
auth-server/src/middleware/auth.middleware.ts - Google OAuth → Auth routes: verifies credentials
- Call operator → Call dispatch API: dispatches calls
- Call dispatch API → LiveKit calling: dispatches agent
- LiveKit calling → Voice worker: starts worker
- Voice worker → Speech recognition: transcribes speech
career_counselling_ai_agent/src/worker.ts - Voice worker → Conversation model: generates replies
career_counselling_ai_agent/src/worker.ts - Voice worker → Speech synthesis: synthesizes speech
career_counselling_ai_agent/src/worker.ts - Voice worker → Counselling leads: records leads
career_counselling_ai_agent/src/worker.ts