~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix: remove Document Collections from RAG Manager to eliminate UI overlap
LearningCircuit5787b78d4ed3
diff --git a/src/local_deep_research/web/static/js/rag_manager.js b/src/local_deep_research/web/static/js/rag_manager.jsindex 409569a9fd..ede5a4b85e 100644--- a/src/local_deep_research/web/static/js/rag_manager.js+++ b/src/local_deep_research/web/static/js/rag_manager.js@@ -772,418 +772,3 @@ function escapeHtml(text) {div.textContent = text;return div.innerHTML;}--// Store collections data-let collections = [];-let currentCollectionId = null;-let selectedFiles = [];--/**- * Load document collections- */-async function loadCollections() {- try {- const response = await safeFetch('/library/api/collections');- const data = await response.json();-- if (data.success) {- collections = data.collections;- renderCollections();- } else {- showError('Failed to load collections: ' + data.error);- }- } catch (error) {- console.error('Error loading collections:', error);- showError('Failed to load collections');- }-}--/**- * Render collections grid- */-function renderCollections() {- const container = document.getElementById('collections-container');-- if (collections.length === 0) {- container.innerHTML = `- <div class="ldr-empty-state">- <i class="fas fa-folder-plus fa-3x"></i>- <p>No collections yet. Create your first collection to get started!</p>- </div>- `;- return;- }-- container.innerHTML = collections.map(collection => `- <div class="ldr-collection-card" data-id="${collection.id}">- <div class="ldr-collection-header">- <div class="ldr-collection-icon">- <i class="fas fa-folder fa-2x"></i>- </div>- <div>- <div class="ldr-collection-title">${escapeHtml(collection.name)}</div>- ${collection.description ? `<small class="ldr-text-muted">${escapeHtml(collection.description)}</small>` : ''}- </div>- </div>-- <div class="ldr-collection-stats">- <span><i class="fas fa-file"></i> ${collection.document_count || 0} docs</span>- <span><i class="fas fa-folder"></i> ${collection.folder_count || 0} folders</span>- <span><i class="fas fa-clock"></i> ${collection.created_at ? new Date(collection.created_at).toLocaleDateString() : 'Unknown'}</span>- </div>-- <div class="ldr-collection-actions">- <button class="ldr-btn ldr-btn-sm ldr-btn-primary" onclick="showUploadModal(${collection.id}, '${escapeHtml(collection.name)}')">- <i class="fas fa-upload"></i> Upload- </button>- <button class="ldr-btn ldr-btn-sm ldr-btn-success" onclick="indexCollection(${collection.id})">- <i class="fas fa-sync"></i> Index- </button>- <button class="ldr-btn ldr-btn-sm ldr-btn-info" onclick="viewCollectionDocs(${collection.id})">- <i class="fas fa-list"></i> View- </button>- <button class="ldr-btn ldr-btn-sm ldr-btn-danger" onclick="deleteCollection(${collection.id})">- <i class="fas fa-trash"></i>- </button>- </div>- </div>- `).join('');-}--/**- * Get emoji for collection icon- */-function getCollectionEmoji(icon) {- const icons = {- 'folder': '📁',- 'briefcase': '💼',- 'book': '📚',- 'file-alt': '📄',- 'graduation-cap': '🎓',- 'code': '💻',- 'heart': '❤️'- };- return icons[icon] || '📁';-}--/**- * Format bytes to human readable- */-function formatBytes(bytes) {- if (bytes === 0) return '0 B';- const k = 1024;- const sizes = ['B', 'KB', 'MB', 'GB'];- const i = Math.floor(Math.log(bytes) / Math.log(k));- return Math.round(bytes / Math.pow(k, i) * 100) / 100 + ' ' + sizes[i];-}--/**- * Show create collection modal- */-function showCreateCollectionModal() {- document.getElementById('create-collection-modal').style.display = 'flex';-}--/**- * Hide create collection modal- */-function hideCreateCollectionModal() {- document.getElementById('create-collection-modal').style.display = 'none';- document.getElementById('create-collection-form').reset();-}--/**- * Create new collection- */-async function createCollection() {- const name = document.getElementById('collection-name').value.trim();- const description = document.getElementById('collection-description').value.trim();-- if (!name) {- showError('Collection name is required');- return;- }-- try {- const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');- const response = await safeFetch('/library/api/collections', {- method: 'POST',- headers: {- 'Content-Type': 'application/json',- 'X-CSRFToken': csrfToken- },- body: JSON.stringify({- name: name,- description: description,- type: 'user_uploads' // Default to user uploads type- })- });-- const data = await response.json();- if (data.success) {- showSuccess(`Collection "${name}" created successfully`);- hideCreateCollectionModal();- loadCollections();- } else {- showError('Failed to create collection: ' + data.error);- }- } catch (error) {- console.error('Error creating collection:', error);- showError('Failed to create collection');- }-}--/**- * Show upload modal- */-function showUploadModal(collectionId, collectionName) {- currentCollectionId = collectionId;- document.getElementById('upload-collection-name').textContent = collectionName;- document.getElementById('upload-files-modal').style.display = 'flex';- setupDragAndDrop();-}--/**- * Hide upload modal- */-function hideUploadModal() {- document.getElementById('upload-files-modal').style.display = 'none';- selectedFiles = [];- document.getElementById('file-list').style.display = 'none';- document.getElementById('file-items').innerHTML = '';- document.getElementById('upload-btn').disabled = true;- hideNewDocumentForm();-}--/**- * Setup drag and drop- */-function setupDragAndDrop() {- const dropZone = document.getElementById('drop-zone');- const fileInput = document.getElementById('file-input');-- // Click to browse- dropZone.addEventListener('click', () => fileInput.click());-- // File input change- fileInput.addEventListener('change', (e) => {- handleFiles(e.target.files);- });-- // Drag events- dropZone.addEventListener('dragover', (e) => {- e.preventDefault();- dropZone.classList.add('ldr-dragging');- });-- dropZone.addEventListener('dragleave', () => {- dropZone.classList.remove('ldr-dragging');- });-- dropZone.addEventListener('drop', (e) => {- e.preventDefault();- dropZone.classList.remove('ldr-dragging');- handleFiles(e.dataTransfer.files);- });-}--/**- * Handle selected files- */-function handleFiles(files) {- selectedFiles = Array.from(files);-- if (selectedFiles.length > 0) {- document.getElementById('file-list').style.display = 'block';- document.getElementById('upload-btn').disabled = false;-- const fileItems = document.getElementById('file-items');- fileItems.innerHTML = selectedFiles.map((file, index) => `- <div class="ldr-file-item">- <span>${escapeHtml(file.name)} (${formatBytes(file.size)})</span>- <button class="ldr-btn ldr-btn-sm ldr-btn-danger" onclick="removeFile(${index})">Remove</button>- </div>- `).join('');- }-}--/**- * Remove file from selection- */-function removeFile(index) {- selectedFiles.splice(index, 1);- handleFiles(selectedFiles);- if (selectedFiles.length === 0) {- document.getElementById('file-list').style.display = 'none';- document.getElementById('upload-btn').disabled = true;- }-}--/**- * Show new document form- */-function showNewDocumentForm() {- document.getElementById('new-document-form').style.display = 'block';-}--/**- * Hide new document form- */-function hideNewDocumentForm() {- document.getElementById('new-document-form').style.display = 'none';- document.getElementById('new-doc-title').value = '';- document.getElementById('new-doc-content').value = '';-}--/**- * Add new text document- */-function addNewDocument() {- const title = document.getElementById('new-doc-title').value.trim() || 'Untitled Document';- const content = document.getElementById('new-doc-content').value.trim();-- if (!content) {- showError('Document content is required');- return;- }-- // Create a Blob from the text content- const blob = new Blob([content], { type: 'text/plain' });- const file = new File([blob], title + '.txt', { type: 'text/plain' });-- selectedFiles.push(file);- handleFiles(selectedFiles);- hideNewDocumentForm();- showSuccess('Document added to upload queue');-}--/**- * Upload files to collection- */-async function uploadFiles() {- if (!currentCollectionId || selectedFiles.length === 0) return;-- const formData = new FormData();- selectedFiles.forEach(file => {- formData.append('files', file);- });-- try {- const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');- const response = await safeFetch(`/library/api/collections/${currentCollectionId}/upload`, {- method: 'POST',- headers: {- 'X-CSRFToken': csrfToken- },- body: formData- });-- const data = await response.json();- if (data.success) {- const uploadedCount = data.uploaded ? data.uploaded.length : 0;- showSuccess(`Successfully uploaded ${uploadedCount} files`);- hideUploadModal();- loadCollections();- } else {- showError('Upload failed: ' + data.error);- }- } catch (error) {- console.error('Error uploading files:', error);- showError('Failed to upload files');- }-}--/**- * Index all documents in a collection- */-async function indexCollection(collectionId) {- if (!confirm('Index all documents in this collection?')) return;-- try {- const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');- const response = await safeFetch(`/library/api/collections/${collectionId}/index`, {- method: 'POST',- headers: {- 'Content-Type': 'application/json',- 'X-CSRFToken': csrfToken- },- body: JSON.stringify({ force_reindex: false })- });-- if (response.ok) {- // Handle SSE for progress- const eventSource = new EventSource(`/library/api/collections/${collectionId}/index`);-- eventSource.onmessage = function(event) {- const data = JSON.parse(event.data);-- if (data.type === 'complete') {- showSuccess(`Indexing complete! ${data.results.successful} documents indexed.`);- eventSource.close();- loadCollections();- } else if (data.type === 'error') {- showError(`Indexing error: ${data.error}`);- eventSource.close();- }- };- }- } catch (error) {- console.error('Error indexing collection:', error);- showError('Failed to index collection');- }-}--/**- * View documents in a collection- */-async function viewCollectionDocs(collectionId) {- try {- const response = await safeFetch(`/library/api/collections/${collectionId}/documents`);- const data = await response.json();-- if (data.success) {- // Show documents in a modal or redirect to a detailed view- console.log('Collection documents:', data.documents);- showSuccess(`Collection has ${data.documents.length} documents`);- } else {- showError('Failed to load collection documents');- }- } catch (error) {- console.error('Error loading collection documents:', error);- showError('Failed to load collection documents');- }-}--/**- * Delete a collection- */-async function deleteCollection(collectionId) {- if (!confirm('Are you sure you want to delete this collection? This action cannot be undone.')) return;-- try {- const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');- const response = await safeFetch(`/library/api/collections/${collectionId}`, {- method: 'DELETE',- headers: {- 'X-CSRFToken': csrfToken- }- });-- const data = await response.json();- if (data.success) {- showSuccess('Collection deleted successfully');- loadCollections();- } else {- showError('Failed to delete collection: ' + data.error);- }- } catch (error) {- console.error('Error deleting collection:', error);- showError('Failed to delete collection');- }-}--// Initialize collections on page load-document.addEventListener('DOMContentLoaded', function() {- loadCollections();- // Keep existing initialization code...-});diff --git a/src/local_deep_research/web/templates/pages/rag_manager.html b/src/local_deep_research/web/templates/pages/rag_manager.htmlindex 14b6e43d54..d4f9f0cd30 100644--- a/src/local_deep_research/web/templates/pages/rag_manager.html+++ b/src/local_deep_research/web/templates/pages/rag_manager.html@@ -95,26 +95,6 @@</button></div>- <!-- Document Collections Section -->- <div class="ldr-collections-section ldr-mt-4">- <h3><i class="fas fa-layer-group"></i> Document Collections</h3>- <p class="ldr-form-text ldr-text-muted">Organize your documents into collections. Each collection can be searched independently.</p>-- <!-- Create New Collection -->- <div class="ldr-new-collection-form">- <button class="ldr-btn ldr-btn-primary" onclick="showCreateCollectionModal()">- <i class="fas fa-plus"></i> Create New Collection- </button>- </div>-- <!-- Collections List -->- <div id="collections-container" class="ldr-collections-grid ldr-mt-3">- <!-- Collections will be loaded here dynamically -->- <div class="ldr-loading-spinner">- <i class="fas fa-spinner fa-spin"></i> Loading collections...- </div>- </div>- </div><!-- Progress Display --><div id="progress-container" class="ldr-mt-4" style="display: none;">@@ -154,93 +134,6 @@</div></div>-<!-- Create Collection Modal -->-<div id="create-collection-modal" class="ldr-modal" style="display: none;">- <div class="ldr-modal-content">- <div class="ldr-modal-header">- <h2>Create New Collection</h2>- <span class="ldr-modal-close" onclick="hideCreateCollectionModal()">×</span>- </div>- <div class="ldr-modal-body">- <form id="create-collection-form">- <div class="ldr-form-group">- <label for="collection-name">Collection Name</label>- <input type="text" id="collection-name" class="ldr-form-control" placeholder="e.g., Work Documents" required>- </div>- <div class="ldr-form-group">- <label for="collection-description">Description</label>- <textarea id="collection-description" class="ldr-form-control" rows="3" placeholder="Optional description"></textarea>- </div>- <div class="ldr-form-group">- <label for="collection-icon">Icon</label>- <select id="collection-icon" class="ldr-form-control">- <option value="folder">📁 Folder</option>- <option value="briefcase">💼 Briefcase</option>- <option value="book">📚 Book</option>- <option value="file-alt">📄 Document</option>- <option value="graduation-cap">🎓 Academic</option>- <option value="code">💻 Code</option>- <option value="heart">❤️ Personal</option>- </select>- </div>- <div class="ldr-form-group">- <label for="collection-color">Color</label>- <input type="color" id="collection-color" class="ldr-form-control" value="#007bff">- </div>- </form>- </div>- <div class="ldr-modal-footer">- <button class="ldr-btn ldr-btn-secondary" onclick="hideCreateCollectionModal()">Cancel</button>- <button class="ldr-btn ldr-btn-primary" onclick="createCollection()">Create Collection</button>- </div>- </div>-</div>--<!-- Upload Files Modal -->-<div id="upload-files-modal" class="ldr-modal" style="display: none;">- <div class="ldr-modal-content ldr-modal-large">- <div class="ldr-modal-header">- <h2>Upload Documents to <span id="upload-collection-name"></span></h2>- <span class="ldr-modal-close" onclick="hideUploadModal()">×</span>- </div>- <div class="ldr-modal-body">- <!-- Drag & Drop Zone -->- <div id="drop-zone" class="ldr-drop-zone">- <i class="fas fa-cloud-upload-alt fa-3x"></i>- <p>Drag and drop files here or click to browse</p>- <p class="ldr-text-muted">Supported: PDF, TXT, MD, HTML, DOC, DOCX</p>- <input type="file" id="file-input" multiple accept=".pdf,.txt,.md,.html,.doc,.docx" style="display: none;">- </div>-- <!-- File List -->- <div id="file-list" class="ldr-file-list ldr-mt-3" style="display: none;">- <h4>Selected Files</h4>- <div id="file-items"></div>- </div>-- <!-- Create New Text Document -->- <div class="ldr-new-document-section ldr-mt-3">- <button class="ldr-btn ldr-btn-outline-primary" onclick="showNewDocumentForm()">- <i class="fas fa-file-plus"></i> Create New Text Document- </button>- <div id="new-document-form" style="display: none;" class="ldr-mt-3">- <input type="text" id="new-doc-title" class="ldr-form-control ldr-mb-2" placeholder="Document title">- <textarea id="new-doc-content" class="ldr-form-control" rows="10" placeholder="Enter or paste your text here..."></textarea>- <div class="ldr-mt-2">- <button class="ldr-btn ldr-btn-primary" onclick="addNewDocument()">Add Document</button>- <button class="ldr-btn ldr-btn-secondary" onclick="hideNewDocumentForm()">Cancel</button>- </div>- </div>- </div>- </div>- <div class="ldr-modal-footer">- <button class="ldr-btn ldr-btn-secondary" onclick="hideUploadModal()">Cancel</button>- <button class="ldr-btn ldr-btn-primary" onclick="uploadFiles()" id="upload-btn" disabled>- <i class="fas fa-upload"></i> Upload & Index Files- </button>- </div>- </div>-</div><style>.ldr-library-container {@@ -389,69 +282,6 @@gap: 20px;}-.ldr-collections-section {- margin-top: 30px;- padding-top: 30px;- border-top: 2px solid var(--border-color, #444);-}--.ldr-collections-section h3 {- margin-bottom: 15px;- font-size: 1.3em;- color: var(--text-primary, #e4e4e4);-}--.ldr-collections-grid {- display: grid;- grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));- gap: 20px;- margin-top: 20px;-}--.ldr-collection-card {- background: var(--card-bg, #2a2a2a);- border: 2px solid var(--border-color, #444);- border-radius: 8px;- padding: 20px;- transition: all 0.3s;- cursor: pointer;-}--.ldr-collection-card:hover {- border-color: var(--primary-color, #007bff);- box-shadow: 0 4px 12px rgba(0,0,0,0.2);-}--.ldr-collection-header {- display: flex;- align-items: center;- margin-bottom: 15px;-}--.ldr-collection-icon {- font-size: 2em;- margin-right: 15px;-}--.ldr-collection-title {- font-size: 1.2em;- font-weight: 600;- color: var(--text-primary, #e4e4e4);-}--.ldr-collection-stats {- display: flex;- gap: 15px;- margin: 15px 0;- font-size: 0.9em;- color: var(--text-secondary, #999);-}--.ldr-collection-actions {- display: flex;- gap: 10px;- margin-top: 15px;-}/* Modal Styles */.ldr-modal {@@ -511,53 +341,6 @@gap: 10px;}-/* Drag & Drop Zone */-.ldr-drop-zone {- border: 2px dashed var(--border-color, #444);- border-radius: 8px;- padding: 40px;- text-align: center;- cursor: pointer;- transition: all 0.3s;-}--.ldr-drop-zone:hover {- border-color: var(--primary-color, #007bff);- background: rgba(13, 110, 253, 0.1);-}--.ldr-drop-zone.dragging {- border-color: var(--success-color, #28a745);- background: rgba(40, 167, 69, 0.1);-}--.ldr-drop-zone i {- color: var(--primary-color, #007bff);- margin-bottom: 15px;-}--.ldr-file-list {- max-height: 300px;- overflow-y: auto;- border: 1px solid var(--border-color, #444);- border-radius: 4px;- padding: 15px;-}--.ldr-file-item {- display: flex;- justify-content: space-between;- align-items: center;- padding: 10px;- margin-bottom: 10px;- background: var(--input-bg, #1a1a1a);- border-radius: 4px;-}--.ldr-file-item button {- padding: 4px 8px;- font-size: 0.85em;-}.ldr-mb-2 {margin-bottom: 10px;