How krisnasetyadi/doculens-ui works
DocuLens is a Next.js frontend for document-based AI Q&A. Users enter the workspace to ask questions, review answers with source links, and open cited PDFs; they can also manage knowledge sources and browse prior conversations. The app includes authentication, compliance/gap-analysis tools, and subscription/payment flows. The README documents the chat-to-backend request flow and PDF citation behavior; sampled service code confirms authenticated requests, while unsampled route and feature wiring is represented conservatively.
Main entry points: request-handler.ts HTTP request handler · chat-interface.tsx Chat interface · page.tsx Ask workspace · use-chat-thread.ts Chat thread state
Components 23
Workspace experience
- Ask workspace
app/(workspace)/ask/page.tsx - Chat interface
components/workspace/chat-interface/chat-interface.tsx - Chat thread state
hooks/use-chat-thread.ts - History and search
app/(workspace)/history/page.tsx - PDF viewer
components/pdf-viewer-dialog.tsx
Knowledge sources
- Sources workspace
app/(workspace)/sources/page.tsx - Source management
components/workspace/sources-panel/sources-panel.tsx - Source data hooks
hooks/use-source-inventory.ts - Compliance runs
app/(workspace)/compliance/[runId]/page.tsx - Gap analysis
components/gap-analysis-dialog.tsx
Identity and billing
- Login and registration
app/(auth)/login/page.tsx - Authentication state
stores/auth-store.ts - Payment flow
app/payment/page.tsx
Backend integration
- HTTP request handler
services/request-handler.ts - Hybrid query API
services/resources/hybrid-query-api.ts - Session API
services/resources/sessions-api.ts - PDF collection API
services/resources/pdf-collection-api.ts - Database connection API
services/resources/database-connection-api.ts - Gap analysis API
services/resources/gap-analysis-api.ts - Authentication API
services/resources/auth-api.ts - Payment API
services/resources/payment-api.ts
Other components
- User
- Backend API
Connections 19
- User → Ask workspace: opens workspace
- Ask workspace → Chat interface: renders
- Chat interface → Chat thread state: uses thread state
- Chat thread state → Hybrid query API: submits questions
- Hybrid query API → HTTP request handler: uses HTTP client
- HTTP request handler → Backend API: sends authenticated requests
- Backend API → HTTP request handler: returns responses
- Chat interface → PDF viewer: opens citations
- PDF viewer → PDF collection API: retrieves PDF
- History and search → Session API: loads conversations
- Sources workspace → Source management: renders
- Source management → Source data hooks: uses source state
- Source data hooks → Database connection API: manages connections
- Compliance runs → Gap analysis: presents analysis
- Gap analysis → Gap analysis API: requests analysis
- Login and registration → Authentication API: authenticates
- Authentication API → Authentication state: stores session token
- Payment flow → Payment API: starts payment
- Payment API → HTTP request handler: uses HTTP client