How v-v-sumanth-kumar/ai-knowledge-inbox works
AI Knowledge Inbox lets a user save notes or URLs, then ask questions answered from saved content with cited snippets. The documented backend flow validates and optionally scrapes content, chunks and embeds it, and stores chunks with the knowledge records; querying embeds the question, searches for similar chunks, hydrates source details, and generates an answer. The frontend exposes dashboard, knowledge-management, and streaming Ask views. Some route and UI internals are unsampled, so their links are limited to index references or README statements.
Main entry points: main.py Application setup · ingestion_service.py Ingestion service · rag_service.py RAG service · App.tsx App routes
Components 32
Frontend
- App routes
frontend/src/App.tsx - Dashboard
frontend/src/pages/DashboardPage.tsx - Knowledge manager
frontend/src/pages/KnowledgePage.tsx - Ask page
frontend/src/pages/AskPage.tsx - Knowledge queries
frontend/src/hooks/useKnowledge.ts - Answer stream
frontend/src/hooks/useAskStream.ts - Knowledge API
frontend/src/api/knowledge.ts - SSE client
frontend/src/api/stream.ts - HTTP client
frontend/src/api/client.ts - Cited answers
frontend/src/components/AnswerPanel.tsx
API
- Ingest route
backend/app/api/ingest.py - Items and stats
backend/app/api/items.py - Query route
backend/app/api/query.py - Application setup
backend/app/main.py - API schemas
backend/app/database/schemas.py
Ingestion
- Ingestion service
backend/app/services/ingestion_service.py - URL scraper
backend/app/services/scraper_service.py - Text chunking
backend/app/utils/chunking.py - Input validation
backend/app/utils/validators.py
Retrieval and storage
- RAG service
backend/app/services/rag_service.py - Embedding service
backend/app/services/embedding_service.py - Local embeddings
backend/app/services/local_embedding_service.py - Vector search
backend/app/services/vector_service.py - Knowledge repository
backend/app/repositories/knowledge_repository.py - SQLite database
backend/app/database/database.py - Knowledge records
backend/app/database/models.py - Chat model client
backend/app/services/llm_client.py
Backend support
- Configuration
backend/app/core/config.py - App exceptions
backend/app/core/exceptions.py - Structured logging
backend/app/core/logging.py
Other components
- User
- Groq / compatible API
Connections 41
- User → App routes: uses
- App routes → Dashboard: routes to
frontend/src/App.tsx - App routes → Knowledge manager: routes to
frontend/src/App.tsx - App routes → Ask page: routes to
frontend/src/App.tsx - Dashboard → Knowledge queries: loads counts
frontend/src/pages/DashboardPage.tsx - Knowledge manager → Knowledge queries: manages items
frontend/src/pages/KnowledgePage.tsx - Ask page → Answer stream: requests answers
frontend/src/pages/AskPage.tsx - Ask page → Cited answers: renders
frontend/src/pages/AskPage.tsx - Knowledge queries → Knowledge API: calls
frontend/src/hooks/useKnowledge.ts - Answer stream → SSE client: streams via
frontend/src/hooks/useAskStream.ts - Knowledge API → HTTP client: uses
- SSE client → HTTP client: uses
frontend/src/api/stream.ts - HTTP client → Ingest route: sends API request
- HTTP client → Query route: sends API request
- Application setup → Ingest route: registers
backend/app/main.py - Application setup → Items and stats: registers
backend/app/main.py - Application setup → Query route: registers
backend/app/main.py - Ingest route → Ingestion service: invokes
backend/app/api/ingest.py - Query route → RAG service: invokes
backend/app/api/query.py - Ingestion service → URL scraper: fetches URL
backend/app/services/ingestion_service.py - Ingestion service → Text chunking: splits text
backend/app/services/ingestion_service.py - Ingestion service → Input validation: validates input
backend/app/services/ingestion_service.py - Ingestion service → Embedding service: embeds chunks
backend/app/services/ingestion_service.py - Ingestion service → Knowledge repository: stores chunks
backend/app/services/ingestion_service.py - RAG service → Embedding service: embeds question
backend/app/services/rag_service.py - RAG service → Vector search: searches vectors
backend/app/services/rag_service.py - RAG service → Knowledge repository: loads sources
backend/app/services/rag_service.py - RAG service → Chat model client: creates client
backend/app/services/rag_service.py - Chat model client → Groq / compatible API: calls
- Embedding service → Local embeddings: selects local
backend/app/services/embedding_service.py - Embedding service → Groq / compatible API: requests vectors
- Knowledge repository → Knowledge records: reads and writes
backend/app/repositories/knowledge_repository.py - SQLite database → Knowledge records: maps records
backend/app/database/database.py - Vector search → Knowledge records: searches stored vectors
backend/app/services/vector_service.py - Application setup → SQLite database: initializes
backend/app/main.py - Application setup → API schemas: uses responses
backend/app/main.py - Application setup → Configuration: loads settings
backend/app/main.py - Application setup → Structured logging: configures
backend/app/main.py - Application setup → App exceptions: registers handlers
- Ingest route → API schemas: accepts DTOs
backend/app/api/ingest.py - Query route → API schemas: returns DTOs
backend/app/api/query.py