Skip to content

~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.

feat: add three-mode download UI for PDFs and text extraction

LearningCircuiteb4136f2f2db
diff --git a/src/local_deep_research/web/templates/pages/download_manager.html b/src/local_deep_research/web/templates/pages/download_manager.html
index 7aaee95c3a..f51263c10d 100644
--- a/src/local_deep_research/web/templates/pages/download_manager.html
+++ b/src/local_deep_research/web/templates/pages/download_manager.html
@@ -10,9 +10,28 @@
<button class="btn btn-secondary" onclick="window.location.href='/library'">
<i class="fas fa-book"></i> Back to Library
</button>
- <button class="btn btn-primary" id="download-selected" disabled>
- <i class="fas fa-download"></i> Download Selected (<span id="selected-count">0</span>)
- </button>
+ <div class="ldr-btn-group ldr-download-buttons">
+ <button class="btn btn-success" id="download-pdfs" disabled
+ {% if not enable_pdf_storage %}
+ title="PDF downloads are disabled. Enable PDF storage in Settings → Research Library"
+ {% else %}
+ title="Download PDF files to disk and store metadata in encrypted database"
+ {% endif %}>
+ <i class="fas fa-file-pdf"></i> Download PDFs (<span class="ldr-selected-count-pdf">0</span>)
+ </button>
+ <button class="btn btn-warning" id="download-text-rag" disabled
+ {% if not enable_txt_storage %}
+ title="Text file storage is disabled. Enable in Settings → Research Library to save .txt files for RAG/search integration"
+ {% else %}
+ title="Extract text to encrypted database AND save .txt files to disk for RAG/search integration"
+ {% endif %}>
+ <i class="fas fa-file-alt"></i> Extract + RAG (<span class="ldr-selected-count-text-rag">0</span>)
+ </button>
+ <button class="btn btn-info" id="download-text-db" disabled
+ title="Extract text to encrypted database only (no files saved to disk - maximum privacy)">
+ <i class="fas fa-database"></i> Extract to DB (<span class="ldr-selected-count-text-db">0</span>)
+ </button>
+ </div>
</div>
</div>
@@ -255,8 +274,30 @@
<button class="btn btn-sm" onclick="viewResearch('{{ research.id }}')">
<i class="fas fa-eye"></i> View Research
</button>
- <button class="btn btn-sm" onclick="downloadResearch('{{ research.id }}')">
- <i class="fas fa-download"></i> Download All PDFs
+ <button class="btn btn-sm btn-success"
+ onclick="downloadResearch('{{ research.id }}', 'pdf')"
+ {% if not enable_pdf_storage %}
+ disabled
+ title="PDF downloads are disabled. Enable PDF storage in Settings"
+ {% else %}
+ title="Download PDFs from this research"
+ {% endif %}>
+ <i class="fas fa-file-pdf"></i> PDFs
+ </button>
+ <button class="btn btn-sm btn-warning"
+ onclick="downloadResearch('{{ research.id }}', 'text_with_files')"
+ {% if not enable_txt_storage %}
+ disabled
+ title="Text file storage is disabled. Enable in Settings"
+ {% else %}
+ title="Extract text + save RAG files from this research"
+ {% endif %}>
+ <i class="fas fa-file-alt"></i> Text+RAG
+ </button>
+ <button class="btn btn-sm btn-info"
+ onclick="downloadResearch('{{ research.id }}', 'text_only')"
+ title="Extract text to encrypted DB only from this research">
+ <i class="fas fa-database"></i> Text DB
</button>
{% if research.downloaded_count > 0 %}
<button class="btn btn-sm" onclick="viewDownloaded('{{ research.id }}')">
@@ -308,6 +349,17 @@
margin-bottom: 20px;
}
+.ldr-download-buttons {
+ display: flex;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+
+.ldr-download-buttons button:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+}
+
/* Library Settings Info Banner */
.ldr-library-settings-info {
margin-bottom: 25px;
@@ -317,8 +369,8 @@
display: flex;
gap: 15px;
padding: 20px;
- background: var(--bg-color, #f8f9fa);
- border: 1px solid var(--border-color, #dee2e6);
+ background: var(--bg-secondary, #2a2a2a);
+ border: 1px solid var(--border-color, #444);
border-radius: 8px;
}
@@ -345,19 +397,19 @@
}
.ldr-info-banner .ldr-warning-message {
- color: var(--warning-color, #dc3545);
- background: rgba(220, 53, 69, 0.1);
+ color: #ff9800;
+ background: rgba(255, 152, 0, 0.15);
padding: 8px 12px;
border-radius: 4px;
- border-left: 3px solid var(--warning-color, #dc3545);
+ border-left: 3px solid #ff9800;
}
.ldr-info-banner .ldr-info-message {
- color: var(--info-color, #0dcaf0);
- background: rgba(13, 202, 240, 0.1);
+ color: #0dcaf0;
+ background: rgba(13, 202, 240, 0.15);
padding: 8px 12px;
border-radius: 4px;
- border-left: 3px solid var(--info-color, #0dcaf0);
+ border-left: 3px solid #0dcaf0;
}
.ldr-info-banner .ldr-settings-link {
@@ -639,10 +691,11 @@
.ldr-research-actions {
display: flex;
- gap: 10px;
+ gap: 8px;
margin-top: 15px;
padding-top: 15px;
border-top: 1px solid var(--border-color);
+ flex-wrap: wrap;
}
.ldr-research-actions .btn {
@@ -653,15 +706,21 @@
border-radius: 4px;
cursor: pointer;
transition: all 0.2s;
- font-size: 14px;
+ font-size: 13px;
+ white-space: nowrap;
}
-.ldr-research-actions .btn:hover {
+.ldr-research-actions .btn:hover:not(:disabled) {
background: var(--primary-color);
color: white;
border-color: var(--primary-color);
}
+.ldr-research-actions .btn:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+}
+
.ldr-bulk-actions {
display: flex;
gap: 10px;
@@ -877,8 +936,26 @@ document.querySelectorAll('.ldr-research-select').forEach(checkbox => {
function updateSelectedCount() {
const count = selectedResearches.size;
- document.getElementById('selected-count').textContent = count;
- document.getElementById('download-selected').disabled = count === 0;
+
+ // Update all count displays
+ document.querySelectorAll('.ldr-selected-count-pdf, .ldr-selected-count-text-rag, .ldr-selected-count-text-db').forEach(el => {
+ el.textContent = count;
+ });
+
+ // Enable/disable buttons based on count and settings
+ const pdfBtn = document.getElementById('download-pdfs');
+ const textRagBtn = document.getElementById('download-text-rag');
+ const textDbBtn = document.getElementById('download-text-db');
+
+ if (pdfBtn) {
+ pdfBtn.disabled = count === 0 {% if not enable_pdf_storage %}|| true{% endif %};
+ }
+ if (textRagBtn) {
+ textRagBtn.disabled = count === 0 {% if not enable_txt_storage %}|| true{% endif %};
+ }
+ if (textDbBtn) {
+ textDbBtn.disabled = count === 0;
+ }
}
// Bulk selection
@@ -904,25 +981,41 @@ function selectFiltered() {
}
// Download functions
-document.getElementById('download-selected').addEventListener('click', () => {
+document.getElementById('download-pdfs')?.addEventListener('click', () => {
if (selectedResearches.size === 0) return;
+ document.getElementById('download-progress-modal').style.display = 'block';
+ startBulkDownload(Array.from(selectedResearches), 'pdf');
+});
- // Show progress modal
+document.getElementById('download-text-rag')?.addEventListener('click', () => {
+ if (selectedResearches.size === 0) return;
document.getElementById('download-progress-modal').style.display = 'block';
+ startBulkDownload(Array.from(selectedResearches), 'text_with_files');
+});
- // Start download process
- startBulkDownload(Array.from(selectedResearches));
+document.getElementById('download-text-db')?.addEventListener('click', () => {
+ if (selectedResearches.size === 0) return;
+ document.getElementById('download-progress-modal').style.display = 'block';
+ startBulkDownload(Array.from(selectedResearches), 'text_only');
});
let currentDownloadController = null;
-async function startBulkDownload(researchIds) {
+async function startBulkDownload(researchIds, mode = 'pdf') {
// Get CSRF token from meta tag
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
// Create abort controller for cancellation
currentDownloadController = new AbortController();
+ // Set modal title based on mode
+ const modalTitles = {
+ 'pdf': 'Downloading PDFs',
+ 'text_with_files': 'Extracting Text + RAG Files',
+ 'text_only': 'Extracting Text to Database'
+ };
+ document.querySelector('#download-progress-modal h2').textContent = modalTitles[mode] || 'Processing';
+
try {
const response = await fetch('/library/api/download-bulk', {
method: 'POST',
@@ -930,7 +1023,10 @@ async function startBulkDownload(researchIds) {
'Content-Type': 'application/json',
'X-CSRFToken': csrfToken
},
- body: JSON.stringify({research_ids: researchIds}),
+ body: JSON.stringify({
+ research_ids: researchIds,
+ mode: mode
+ }),
signal: currentDownloadController.signal
});
@@ -1000,9 +1096,10 @@ function updateProgress(data) {
}
}
-// Individual download
-function downloadResearch(researchId) {
- startBulkDownload([researchId]);
+// Individual research download
+function downloadResearch(researchId, mode = 'pdf') {
+ document.getElementById('download-progress-modal').style.display = 'block';
+ startBulkDownload([researchId], mode);
}
// Navigation