~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: address remaining PR review comments from djpetti
LearningCircuit9f8fe40e0b5f
diff --git a/src/local_deep_research/defaults/default_settings.json b/src/local_deep_research/defaults/default_settings.jsonindex 9fd7e94de2..93849d3132 100644--- a/src/local_deep_research/defaults/default_settings.json+++ b/src/local_deep_research/defaults/default_settings.json@@ -5244,5 +5244,33 @@"ui_element": "checkbox","value": false,"visible": true+ },+ "research_library.storage_path": {+ "category": "research_library",+ "description": "Base path for storing research library documents",+ "editable": true,+ "max_value": null,+ "min_value": null,+ "name": "Library Storage Path",+ "options": null,+ "step": null,+ "type": "APP",+ "ui_element": "text",+ "value": "~/Documents/LocalDeepResearch/Library",+ "visible": true+ },+ "research_library.path_locked": {+ "category": "research_library",+ "description": "If true, prevents users from changing the library storage path through the UI",+ "editable": false,+ "max_value": null,+ "min_value": null,+ "name": "Lock Library Path",+ "options": null,+ "step": null,+ "type": "APP",+ "ui_element": "checkbox",+ "value": false,+ "visible": false}}diff --git a/src/local_deep_research/defaults/research_library/library_settings.json b/src/local_deep_research/defaults/research_library/library_settings.jsonnew file mode 100644index 0000000000..bab9cd67de--- /dev/null+++ b/src/local_deep_research/defaults/research_library/library_settings.json@@ -0,0 +1,16 @@+{+ "research_library": {+ "storage_path": {+ "value": "~/Documents/LocalDeepResearch/Library",+ "description": "Base path for storing research library documents. Can be overridden by RESEARCH_LIBRARY_STORAGE_PATH environment variable.",+ "type": "string",+ "env_var": "RESEARCH_LIBRARY_STORAGE_PATH"+ },+ "path_locked": {+ "value": false,+ "description": "If true, prevents users from changing the library storage path through the UI. Can be overridden by RESEARCH_LIBRARY_PATH_LOCKED environment variable.",+ "type": "boolean",+ "env_var": "RESEARCH_LIBRARY_PATH_LOCKED"+ }+ }+}diff --git a/src/local_deep_research/research_library/routes/library_routes.py b/src/local_deep_research/research_library/routes/library_routes.pyindex 21682776ea..1edf67b6f9 100644--- a/src/local_deep_research/research_library/routes/library_routes.py+++ b/src/local_deep_research/research_library/routes/library_routes.py@@ -985,6 +985,5 @@ def download_source():if success:return jsonify({"success": True, "message": "Download completed"})else:- return jsonify(- {"success": False, "message": message or "Download failed"}- )+ # Log internal message, but show only generic message to user+ return jsonify({"success": False, "message": "Download failed"})diff --git a/src/local_deep_research/research_library/services/download_service.py b/src/local_deep_research/research_library/services/download_service.pyindex 0f1f1f0c77..b68f88ac44 100644--- a/src/local_deep_research/research_library/services/download_service.py+++ b/src/local_deep_research/research_library/services/download_service.py@@ -530,7 +530,7 @@ class DownloadService:)if not validated_path:- raise ValueError(f"Invalid file path: {filename}")+ raise ValueError("Invalid file path")# Write the PDF filewith open(validated_path, "wb") as f:@@ -634,7 +634,7 @@ class DownloadService:)if not validated_path:- raise ValueError(f"Invalid file path: {filename}")+ raise ValueError("Invalid file path")# Write the text file with UTF-8 encodingwith open(validated_path, "w", encoding="utf-8") as f:diff --git a/src/local_deep_research/research_library/utils/__init__.py b/src/local_deep_research/research_library/utils/__init__.pyindex 62fe349ac2..d1364d3657 100644--- a/src/local_deep_research/research_library/utils/__init__.py+++ b/src/local_deep_research/research_library/utils/__init__.py@@ -25,7 +25,12 @@ def get_url_hash(url: str) -> str:def get_library_storage_path(username: str) -> Path:"""Get the storage path for a user's library.- Uses settings for base path, but always includes username subdirectory for isolation.++ Uses the settings system which respects environment variable overrides:+ - research_library.storage_path: Base path for library storage+ - research_library.path_locked: If true, prevents UI from showing path config++ Always adds username subdirectory for multi-user isolation.Args:username: The username@@ -36,6 +41,8 @@ def get_library_storage_path(username: str) -> Path:from ...utilities.db_utils import get_settings_managersettings = get_settings_manager()++ # Get the base path from settings (env vars will override if set)base_path = Path(settings.get_setting("research_library.storage_path",@@ -43,8 +50,7 @@ def get_library_storage_path(username: str) -> Path:)).expanduser()- # IMPORTANT: Add username subdirectory for user isolation- # This prevents users from accessing/overwriting each other's files+ # Always add username subdirectory for user isolation in multi-user environmentsbase_dir = base_path / usernamebase_dir.mkdir(parents=True, exist_ok=True)return base_dirdiff --git a/src/local_deep_research/web/static/js/components/sources-panel.js b/src/local_deep_research/web/static/js/components/sources-panel.jsindex ec1defb3b7..2c21e2f960 100644--- a/src/local_deep_research/web/static/js/components/sources-panel.js+++ b/src/local_deep_research/web/static/js/components/sources-panel.js@@ -43,7 +43,7 @@function createOffcanvasHTML() {const html = `<!-- Toggle Button -->- <button class="btn btn-primary sources-panel-toggle"+ <button class="btn btn-primary ldr-sources-panel-toggle"id="sourcesToggle"type="button"title="Toggle Sources Panel">@@ -52,7 +52,7 @@</button><!-- Offcanvas Panel -->- <div class="offcanvas offcanvas-end sources-offcanvas"+ <div class="offcanvas offcanvas-end ldr-sources-offcanvas"tabindex="-1"id="sourcesOffcanvas"data-bs-backdrop="false"@@ -86,7 +86,7 @@</div><!-- Sources List -->- <div id="sourcesList" class="sources-list">+ <div id="sourcesList" class="ldr-sources-list"><div class="text-center p-4"><div class="spinner-border text-primary" role="status"><span class="visually-hidden">Loading...</span>@@ -110,7 +110,7 @@function addCustomStyles() {const style = document.createElement('style');style.textContent = `- .sources-panel-toggle {+ .ldr-sources-panel-toggle {position: fixed;right: 20px;bottom: 80px;@@ -120,18 +120,18 @@box-shadow: 0 2px 10px rgba(0,0,0,0.2);}- .sources-offcanvas {+ .ldr-sources-offcanvas {width: 450px !important;background: var(--card-bg, #fff);border-left: 1px solid var(--border-color, #dee2e6);}- .sources-offcanvas .offcanvas-header {+ .ldr-sources-offcanvas .offcanvas-header {background: var(--bg-color, #f8f9fa);border-bottom: 1px solid var(--border-color, #dee2e6);}- .source-card {+ .ldr-source-card {background: var(--bg-color, #f8f9fa);border: 1px solid var(--border-color, #dee2e6);border-radius: 8px;@@ -140,16 +140,16 @@transition: all 0.2s;}- .source-card:hover {+ .ldr-source-card:hover {border-color: var(--primary-color, #0d6efd);box-shadow: 0 2px 8px rgba(0,0,0,0.1);}- .source-card.downloaded {+ .ldr-source-card.downloaded {border-left: 3px solid var(--success-color, #198754);}- .source-number {+ .ldr-source-number {display: inline-block;background: var(--primary-color, #0d6efd);color: white;@@ -160,13 +160,13 @@margin-right: 8px;}- .source-title {+ .ldr-source-title {font-weight: 600;margin-bottom: 8px;color: var(--text-primary, #212529);}- .source-snippet {+ .ldr-source-snippet {font-size: 14px;color: var(--text-secondary, #6c757d);margin: 10px 0;@@ -176,7 +176,7 @@border-radius: 4px;}- .source-domain {+ .ldr-source-domain {display: inline-block;font-size: 12px;color: var(--text-secondary, #6c757d);@@ -186,7 +186,7 @@margin-bottom: 8px;}- .source-url {+ .ldr-source-url {font-size: 12px;color: var(--text-secondary, #6c757d);white-space: nowrap;@@ -195,23 +195,23 @@margin-bottom: 10px;}- .sources-list {+ .ldr-sources-list {max-height: calc(100vh - 250px);overflow-y: auto;}/* Dark theme adjustments */- [data-theme="dark"] .sources-offcanvas {+ [data-theme="dark"] .ldr-sources-offcanvas {background: #1a1a1a;color: #e0e0e0;}- [data-theme="dark"] .source-card {+ [data-theme="dark"] .ldr-source-card {background: #2a2a2a;border-color: #333;}- [data-theme="dark"] .source-snippet {+ [data-theme="dark"] .ldr-source-snippet {background: rgba(255,255,255,0.05);}`;@@ -298,10 +298,10 @@}listEl.innerHTML = sourcesToRender.map(source => `- <div class="source-card ${source.downloaded ? 'downloaded' : ''}">+ <div class="ldr-source-card ${source.downloaded ? 'downloaded' : ''}"><div class="d-flex justify-content-between align-items-start mb-2"><div>- <span class="source-number">${source.number}</span>+ <span class="ldr-source-number">${source.number}</span>${source.downloaded ?'<i class="fas fa-check-circle text-success" title="Downloaded"></i>' :'<i class="fas fa-cloud-download-alt text-muted" title="Not downloaded"></i>'@@ -309,17 +309,17 @@</div></div>- <div class="source-title">${escapeHtml(source.title)}</div>+ <div class="ldr-source-title">${escapeHtml(source.title)}</div>- ${source.domain ? `<span class="source-domain">${escapeHtml(source.domain)}</span>` : ''}+ ${source.domain ? `<span class="ldr-source-domain">${escapeHtml(source.domain)}</span>` : ''}${source.snippet ? `- <div class="source-snippet">+ <div class="ldr-source-snippet">${escapeHtml(source.snippet).substring(0, 200)}${source.snippet.length > 200 ? '...' : ''}</div>` : ''}- <div class="source-url" title="${escapeHtml(source.url)}">+ <div class="ldr-source-url" title="${escapeHtml(source.url)}">${escapeHtml(source.url)}</div>@@ -335,11 +335,10 @@onclick="sourcesPanel.downloadSource('${escapeHtml(source.url)}')"><i class="fas fa-download"></i> Download</button>- <a href="${escapeHtml(source.url)}"- class="btn btn-sm btn-outline-secondary"- target="_blank">+ <button class="btn btn-sm btn-outline-secondary"+ onclick="sourcesPanel.openExternalUrl('${escapeHtml(source.url)}')"><i class="fas fa-external-link-alt"></i> Open- </a>+ </button>`}</div></div>@@ -435,10 +434,23 @@return div.innerHTML;}+ /**+ * Open external URL with validation+ */+ function openExternalUrl(url) {+ if (URLValidator.isSafeUrl(url)) {+ window.open(url, '_blank');+ } else {+ console.error('Unsafe URL blocked:', url);+ alert('This URL cannot be opened for security reasons.');+ }+ }+// Export public methodswindow.sourcesPanel = {initialize: initializeSourcesPanel,downloadSource: downloadSource,+ openExternalUrl: openExternalUrl,reload: loadSources};