FrontendDocuments
Overview
Document management UI with upload, viewer, and knowledge base organization.
The documents module provides a complete UI for uploading files, managing knowledge bases, viewing documents with chunk highlighting, and attaching knowledge bases to chat sessions.
Component Architecture
Knowledge Base Pages
│
├── KnowledgeBaseList (TanStack Table)
│ ├── Search + sort + pagination
│ ├── Create KB modal
│ └── Delete KB confirmation
│
└── KnowledgeBaseDetail
├── KB metadata (name, description, access)
├── DocumentsTable (documents in this KB)
└── DocumentUpload (add files to KB)
Document Pages
│
├── WorkspaceDocumentsList
│ ├── Documents table
│ └── Upload button
│
└── DocumentViewerPage
├── PDF renderer (pdfjs-dist)
├── Chunk highlighting
└── Page navigation
Chat Integration
│
└── ChatSettingsForm
├── Attach/detach KBs to session
└── KB selector (multi-select command)Pages
| Route | Component | Description |
|---|---|---|
.../documents | WorkspaceDocumentsList | All documents in workspace |
.../documents/[docId]/view | DocumentViewerPage | PDF viewer with chunk highlights |
.../knowledge-bases | KnowledgeBaseList | All KBs in workspace |
.../knowledge-bases/[kbId] | KnowledgeBaseDetail | KB detail + documents |
Features
Document Upload
Drag-and-drop or click-to-select file upload using the S3 presigned URL flow. Supports multi-file upload with per-file progress tracking.
Knowledge Base Management
- Create, edit, delete knowledge bases
- Share with workspace or restrict to teams
- Add/remove documents from KBs
- View document count and status per KB
Document Viewer
Full-page PDF viewer powered by pdfjs-dist:
- Page-by-page rendering
- Chunk highlight overlay (when opened from a citation)
- Page navigation controls
- Responsive sizing
Chat Integration
Knowledge bases are attached to chat sessions via the settings panel. Once attached, the AI agent can search documents in those KBs using the search_knowledge_base tool.
Permission-Based UI
| Action | Owner | Admin | Member |
|---|---|---|---|
| View documents | Yes | Yes | Yes |
| Upload documents | Yes | Yes | Yes |
| Delete documents | Yes | Yes | No |
| Create KB | Yes | Yes | Yes |
| Delete KB | Yes | Yes | No |
| Manage KB access | Yes | Yes | No |