How ganesan2006/trustai works
TrustAI is a multi-tenant document Q&A application: users authenticate, upload files with organization/department/team access scope, then ask questions in conversations and receive generated answers with citations and feedback. The graph shows the documented upload, hybrid retrieval, and answer workflow alongside authentication, administration, analytics, and user-facing pages. Source excerpts establish the API wiring and key storage/RAG calls; unsampled implementations are represented at their exact tree paths, with uncertain internal links omitted.
Main entry points: app.py FastAPI application · action.py RAG orchestrator · dependencies.py Current-user lookup · model.py Relational data models
Components 29
API workflows
- Web interface
static - FastAPI application
app.py - Pages
routers/pages.py - File workflows
routers/files.py - Conversations
routers/conversations.py - Chat and feedback
routers/chat.py
Document Q&A
- RAG orchestrator
action.py - Document loading
processors/document_loader.py - PDF processing
processors/pdf_processor.py - OCR
processors/ocr.py - Zoho OCR
processors/zoho_ocr.py - Sparse vectors
processors/sparse_vector.py - Hybrid vector search
processors/qdrant_db.py - Answer chain
processors/chain_builder.py - Conversation processing
processors/conversation.py
Identity and tenancy
- Authentication
routers/auth.py - Organization resolver
middleware/org_resolver.py - User management
routers/user.py - Current-user lookup
dependencies.py
Admin and analytics
- Administration
routers/admin.py - Usage analytics
routers/admin_analytics.py - API key encryption
utils/encryption.py - File cleanup task
tasks.py
Persistence
- Supabase file storage
processors/supabase_storage.py - Qdrant
- Supabase Storage
- Relational data models
model.py - Database configuration
config.py
Other components
- User
Connections 40
- User → Web interface: uses
README.md - Web interface → FastAPI application: requests
- FastAPI application → Organization resolver: installs
app.py - FastAPI application → Authentication: mounts
app.py - FastAPI application → Conversations: mounts
app.py - FastAPI application → File workflows: mounts
app.py - FastAPI application → Chat and feedback: mounts
app.py - FastAPI application → Pages: mounts
app.py - FastAPI application → Administration: mounts
app.py - FastAPI application → Usage analytics: mounts
app.py - FastAPI application → User management: mounts
app.py - FastAPI application → File cleanup task: starts
app.py - Authentication → Relational data models: queries
routers/auth.py - Organization resolver → FastAPI application: continues request
middleware/org_resolver.py - Current-user lookup → Relational data models: loads user
dependencies.py - File workflows → Current-user lookup: authenticates
routers/files.py - Chat and feedback → Current-user lookup: authenticates
routers/chat.py - Conversations → Current-user lookup: authenticates
routers/conversations.py - File workflows → RAG orchestrator: indexes documents
routers/files.py - File workflows → Supabase file storage: stores files
routers/files.py - Conversations → Supabase file storage: uses storage
routers/conversations.py - RAG orchestrator → Document loading: loads documents
action.py - Document loading → PDF processing: delegates PDFs
processors/document_loader.py - PDF processing → OCR: uses OCR
- PDF processing → Zoho OCR: optional OCR
- RAG orchestrator → Hybrid vector search: delegates search
action.py - RAG orchestrator → Answer chain: builds answer chain
action.py - Hybrid vector search → Sparse vectors: generates sparse vectors
processors/qdrant_db.py - Hybrid vector search → Qdrant: reads and writes vectors
processors/qdrant_db.py - Supabase file storage → Supabase Storage: uploads and downloads
processors/supabase_storage.py - Chat and feedback → RAG orchestrator: queries
routers/chat.py - Conversations → RAG orchestrator: uses RAG
routers/conversations.py - Administration → Current-user lookup: authenticates
routers/admin.py - Administration → API key encryption: encrypts keys
routers/admin.py - Administration → Relational data models: manages records
routers/admin.py - Usage analytics → Relational data models: reads metrics
routers/admin_analytics.py - User management → Current-user lookup: authenticates
routers/user.py - File cleanup task → Relational data models: checks files
tasks.py - File cleanup task → Supabase file storage: deletes stored files
tasks.py - Database configuration → Relational data models: configures sessions
dependencies.py