Document Library

The Document Library is your centralized hub for managing, searching, and leveraging documents within the Plugged.in platform. With advanced AI capabilities, version control, and rich preview features, it transforms how you interact with your knowledge base.

Overview

AI-Powered Search

Semantic search that understands context and intent, providing intelligent answers from your documents

Version Control

Complete version history with diff tracking, model attribution, and rollback capabilities

Rich Previews

Native viewing for PDFs, images, code files, and markdown with zoom and navigation controls

Multi-Source

Support for uploaded files, AI-generated content, and API-created documents

πŸ” AI Search Features

Transform how you find information with our intelligent search capabilities.
How it works: Uses natural language processing to understand the meaning and context of your query.Example Query: β€œHow do I authenticate users in my application?”Returns: Comprehensive answer synthesized from multiple documents with source attribution.Best for:
  • Complex questions requiring context
  • Finding information across multiple documents
  • Getting synthesized answers
  • Natural language queries
1

Enable AI Search

Click the sparkles icon (✨) in the search bar to toggle AI mode
2

Enter Your Query

Type a natural language question or description of what you’re looking for
3

Review the Answer

The AI will provide a comprehensive answer based on your documents
4

Explore Sources

Click on any source document name to open it in the preview modal

AI Search Interface

interface AiSearchResult {
  answer: string;                            // AI-generated answer
  documents: Array<{                         // Source documents
    id: string;
    name: string;                           // Human-readable name
  }>;
  sources: string[];                        // Document excerpts
  confidence: number;                       // Answer confidence score
}
AI Search uses a 500ms debounce to optimize performance and reduce unnecessary API calls while you type.

πŸ“„ Document Management

Supported Formats

CategoryFormatsFeatures
DocumentsPDF, DOCX, TXT, RTFFull-text extraction, searchable
Code20+ languagesSyntax highlighting, line numbers
ImagesPNG, JPG, SVG, GIFZoom controls, pan navigation
MarkdownMD, MDXLive rendering, table support
DataJSON, YAML, XMLStructured view, collapsible sections

Upload Documents

Via Web Interface

  1. Navigate to Library in the sidebar
  2. Click Upload Documents button
  3. Drag and drop or select files
  4. Add metadata (optional):
    • Title: Display name for the document
    • Description: Brief summary
    • Tags: Comma-separated keywords
    • Category: Document classification

Via API

curl -X POST https://plugged.in/api/documents \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F "file=@document.pdf" \
  -F "name=Project Documentation" \
  -F "description=Complete project specs" \
  -F "tags=project,specs,requirements"

Document Sources

πŸ”„ Document Versioning

Track changes and maintain history for all your documents.

Version History Features

Timeline View

Visual timeline of all document versions with timestamps

Diff Visualization

Line-by-line comparison showing additions and deletions

Model Attribution

Track which AI models created or modified each version

Rollback

Restore any previous version with one click

Version Metadata Structure

interface DocumentVersion {
  id: string;
  version_number: number;
  created_by_model: {
    name: string;           // e.g., "Claude 3.5 Sonnet"
    provider: string;       // e.g., "Anthropic"
    version?: string;       // e.g., "3.5"
  };
  created_at: Date;
  change_summary?: string;
  content_diff?: {
    additions: number;      // Lines added
    deletions: number;      // Lines removed
    changes: Array<{
      type: 'addition' | 'deletion' | 'modification';
      content: string;
    }>;
  };
}

Comparing Versions

1

Open Version History

Click the version badge or history icon on any document
2

Enable Compare Mode

Click the β€œCompare” button in the version history panel
3

Select Versions

Choose two versions to compare (checkboxes appear in compare mode)
4

View Differences

Click β€œCompare Selected” to see a detailed diff view

πŸ‘οΈ Document Preview

Rich preview capabilities for all document types with advanced controls.

Preview Features by Type

  • Page Navigation: Previous/Next buttons and page counter
  • Zoom Controls: Fit to width, fit to page, custom zoom
  • Search: Find text within the PDF
  • Download: Original file download
  • Fullscreen: Immersive reading mode

Preview Modal Structure

interface DocumentPreview {
  document: Doc;
  isOpen: boolean;
  viewMode: 'preview' | 'metadata' | 'versions';
  zoomLevel: number;        // 10-500
  currentPage?: number;      // For PDFs
  fullscreen: boolean;
}

🎯 Advanced Features

Bulk Operations

Perform actions on multiple documents simultaneously:
# Bulk upload
curl -X POST https://plugged.in/api/documents/bulk \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "documents": [
      {"name": "Doc1", "content": "..."},
      {"name": "Doc2", "content": "..."}
    ]
  }'

# Bulk delete
curl -X DELETE https://plugged.in/api/documents/bulk \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ids": ["uuid1", "uuid2", "uuid3"]}'

Smart Filters

By Source

Filter by upload source (Upload, AI, API)

By Date

Date range filtering with presets

By Model

Filter by AI model that created/modified

By Tags

Multi-tag filtering with AND/OR logic

Keyboard Shortcuts

ActionShortcut
Toggle AI SearchCmd/Ctrl + K
Open PreviewSpace
Close PreviewEsc
Next Document→
Previous Document←
Toggle FullscreenF
Zoom In+
Zoom Out-

πŸ” Security & Permissions

Access Control

Documents respect project and profile isolation:
  • Project Level: Documents are isolated per project
  • Profile Level: Further isolation within project workspaces
  • Visibility Levels:
    • private: Only accessible to document owner
    • workspace: Shared within the profile/project
    • public: Accessible via public API (with authentication)

Data Protection

All documents are encrypted at rest and in transit
  • Encryption: AES-256-GCM for document content
  • Sanitization: HTML/Markdown content sanitized before display
  • Path Protection: Prevention of directory traversal attacks
  • Rate Limiting:
    • Uploads: 100 per hour
    • Searches: 1000 per hour
    • AI generation: 10 per hour

πŸ“Š Usage Analytics

Track how your documents are being used:
interface DocumentAnalytics {
  views: number;
  searches: number;
  ai_queries: number;
  last_accessed: Date;
  popular_queries: string[];
  access_patterns: {
    hourly: number[];
    daily: number[];
  };
}

πŸš€ Performance Optimization

The Document Library is optimized for speed and efficiency:

Recent Improvements (v2.11.1)

  • 68% reduction in bundle size
  • 60% reduction in memory usage
  • Dynamic import caching for heavy components
  • Comprehensive memoization with React optimization hooks
  • Single useReducer pattern replacing multiple state variables

Best Practices

πŸ”§ API Reference

Core Endpoints

// Upload document
POST /api/documents

// Get document
GET /api/documents/:id

// Update document
PUT /api/documents/:id

// Delete document
DELETE /api/documents/:id

// Search documents
POST /api/documents/search

// AI query
POST /api/documents/ai-search

// Get versions
GET /api/documents/:id/versions

// Compare versions
GET /api/documents/:id/compare?v1=1&v2=2

Response Format

{
  "document": {
    "id": "uuid",
    "name": "Document Name",
    "content": "...",
    "metadata": {
      "source": "upload|ai_generated|api",
      "model": { "name": "...", "provider": "..." },
      "version": 1,
      "created_at": "2025-01-18T..."
    }
  },
  "versions": [...],
  "analytics": {...}
}

Next Steps