How tthanh1223/papersanta_ttnn works
PaperSanta is a research-paper assistant: users authenticate, manage PDFs, read and analyze them, ask PDF-grounded questions, and discover related research. The main document flow is upload and storage, PDF extraction, chunking/embedding, then retrieval and generated answers; paper search and analysis are separate capabilities. The README and sampled routes/services support these connections; some service internals were not sampled, so their finer wiring is left unspecified.
Main entry points: App.tsx Workspace UI · database.py PostgreSQL with vectors · pdf_service.py PDF operations · rag_service.py Retrieval and chat
Components 33
Research workspace
- Workspace UI
frontend/src/App.tsx - Auth context
frontend/src/context/AuthContext.tsx - PDF API client
frontend/src/api/pdf.ts - PDF reader
frontend/src/components/Reader.tsx - Analyzer
frontend/src/components/Analyzer.tsx - Discovery
frontend/src/components/Discovery.tsx - RAG API client
frontend/src/api/rag.ts - Search API client
frontend/src/api/search.ts
PDF library and indexing
- PDF endpoints
app/api/pdf_router.py - PDF operations
app/services/pdf_service.py - PDF extraction
app/services/extraction_service.py - Text normalization
app/services/text_normalization_service.py - Chunking and embeddings
app/services/embedding_service.py
AI and discovery
- RAG endpoints
app/api/rag_router.py - Retrieval and chat
app/services/rag_service.py - Embedding provider
app/core/embedding_provider.py - Analysis endpoints
app/api/analyze_router.py - Document analysis
app/services/analyze_service.py - Search endpoints
app/api/search_router.py - Paper search
app/services/paper_search_service.py
Identity and persistence
- PDF and chunk records
app/models/pdf_document.py - Embedding records
app/models/embedding.py - Chat sessions
app/models/chat.py - JWT verification
app/core/auth.py - PostgreSQL with vectors
app/core/database.py
Other components
- Researcher
- Supabase Auth
- Supabase Storage
- DeepSeek
- Sentence Transformers
- Semantic Scholar
- Gemini
- Tavily
Connections 39
- Researcher → Workspace UI: uses
- Workspace UI → Auth context: authenticates via
- Auth context → Supabase Auth: signs in
- Workspace UI → PDF API client: requests PDFs
- PDF API client → PDF endpoints: calls
- PDF endpoints → JWT verification: verifies user
- PDF endpoints → PDF operations: delegates
- PDF operations → PDF extraction: extracts text
- PDF extraction → Text normalization: normalizes text
- PDF operations → Chunking and embeddings: indexes document
- Chunking and embeddings → Embedding provider: creates vectors
- Chunking and embeddings → PostgreSQL with vectors: stores chunks and vectors
- PDF operations → PostgreSQL with vectors: reads and writes
- PDF operations → Supabase Storage: stores PDF files
- Workspace UI → PDF reader: opens document
- Workspace UI → Analyzer: opens analysis
- Workspace UI → Discovery: opens discovery
- RAG API client → RAG endpoints: calls
- Researcher → RAG API client: asks PDF questions
- RAG endpoints → JWT verification: verifies user
- RAG endpoints → Retrieval and chat: delegates chat
- Retrieval and chat → Embedding provider: embeds query
- Retrieval and chat → PostgreSQL with vectors: retrieves and saves
- Retrieval and chat → DeepSeek: generates answer
- Retrieval and chat → Chat sessions: persists session
- Embedding provider → Sentence Transformers: embeds text
- Analyzer → Analysis endpoints: requests analysis
- Analysis endpoints → Document analysis: delegates
- Document analysis → DeepSeek: analyzes content
- Search API client → Search endpoints: calls
- Discovery → Search API client: finds related papers
- Search endpoints → Paper search: delegates
- Paper search → PostgreSQL with vectors: reads paper topics
- Paper search → Semantic Scholar: searches papers
- Paper search → Gemini: formats results
- Paper search → Tavily: searches papers
- PDF and chunk records → PostgreSQL with vectors: persisted in
- Embedding records → PostgreSQL with vectors: persisted in
- Chat sessions → PostgreSQL with vectors: persisted in