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.

fix: RAG document links fall back to root page instead of txt

LearningCircuitad4ff7365955
diff --git a/src/local_deep_research/web_search_engines/engines/search_engine_collection.py b/src/local_deep_research/web_search_engines/engines/search_engine_collection.py
index ad04a8303c..89131c68ad 100644
--- a/src/local_deep_research/web_search_engines/engines/search_engine_collection.py
+++ b/src/local_deep_research/web_search_engines/engines/search_engine_collection.py
@@ -248,11 +248,13 @@ class CollectionSearchEngine(LibraryRAGSearchEngine):
if not doc_id:
return "#"
+ # Default to root document page (shows all options: PDF, Text, Chunks, etc.)
+ document_url = f"/library/document/{doc_id}"
+
try:
with get_user_db_session(self.username) as session:
document = session.query(Document).filter_by(id=doc_id).first()
if document:
- # Use PDFStorageManager to check if PDF available
from pathlib import Path
library_root = get_setting_from_snapshot(
@@ -263,9 +265,8 @@ class CollectionSearchEngine(LibraryRAGSearchEngine):
library_root = Path(library_root).expanduser()
pdf_manager = PDFStorageManager(library_root, "auto")
if pdf_manager.has_pdf(document, session):
- return f"/library/document/{doc_id}/pdf"
- return f"/library/document/{doc_id}/txt"
+ document_url = f"/library/document/{doc_id}/pdf"
except Exception as e:
logger.warning(f"Error getting document URL for {doc_id}: {e}")
- return f"/library/document/{doc_id}/txt"
+ return document_url
diff --git a/src/local_deep_research/web_search_engines/engines/search_engine_library.py b/src/local_deep_research/web_search_engines/engines/search_engine_library.py
index 28f6580adf..15781760ed 100644
--- a/src/local_deep_research/web_search_engines/engines/search_engine_library.py
+++ b/src/local_deep_research/web_search_engines/engines/search_engine_library.py
@@ -229,8 +229,10 @@ class LibraryRAGSearchEngine(BaseSearchEngine):
else doc.page_content
)
- # Generate URL to document content (PDF or TXT)
- # Use relative URLs - they work in any deployment scenario
+ # Generate URL to document content
+ # Default to root document page (shows all options: PDF, Text, Chunks, etc.)
+ document_url = f"/library/document/{doc_id}" if doc_id else "#"
+
if doc_id:
try:
with get_user_db_session(self.username) as session:
@@ -240,7 +242,6 @@ class LibraryRAGSearchEngine(BaseSearchEngine):
.first()
)
if document:
- # Use PDFStorageManager to check if PDF available
from pathlib import Path
library_root = get_setting_from_snapshot(
@@ -256,20 +257,8 @@ class LibraryRAGSearchEngine(BaseSearchEngine):
document_url = (
f"/library/document/{doc_id}/pdf"
)
- else:
- document_url = (
- f"/library/document/{doc_id}/txt"
- )
- else:
- # Fallback to TXT if document not found
- document_url = f"/library/document/{doc_id}/txt"
except Exception as e:
- logger.warning(
- f"Error querying document {doc_id}: {e}, using TXT fallback"
- )
- document_url = f"/library/document/{doc_id}/txt"
- else:
- document_url = "#"
+ logger.warning(f"Error querying document {doc_id}: {e}")
result = {
"title": title,