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 Library link from History page to corresponding research documents

LearningCircuitafe68f96b17a
diff --git a/src/local_deep_research/research_library/downloaders/arxiv.py b/src/local_deep_research/research_library/downloaders/arxiv.py
index 25d99235ce..0e1c665cd5 100644
--- a/src/local_deep_research/research_library/downloaders/arxiv.py
+++ b/src/local_deep_research/research_library/downloaders/arxiv.py
@@ -61,12 +61,15 @@ class ArxivDownloader(BaseDownloader):
# Combine metadata with full text
full_text = f"{metadata}\n\n{'=' * 80}\nFULL PAPER TEXT\n{'=' * 80}\n\n{extracted_text}"
return DownloadResult(
- content=full_text.encode("utf-8"), is_success=True
+ content=full_text.encode("utf-8", errors="ignore"),
+ is_success=True,
)
else:
# Just return the extracted text
return DownloadResult(
- content=extracted_text.encode("utf-8"),
+ content=extracted_text.encode(
+ "utf-8", errors="ignore"
+ ),
is_success=True,
)
@@ -118,9 +121,9 @@ class ArxivDownloader(BaseDownloader):
if metadata:
# Combine metadata with full text
full_text = f"{metadata}\n\n{'=' * 80}\nFULL PAPER TEXT\n{'=' * 80}\n\n{extracted_text}"
- return full_text.encode("utf-8")
+ return full_text.encode("utf-8", errors="ignore")
else:
- return extracted_text.encode("utf-8")
+ return extracted_text.encode("utf-8", errors="ignore")
return None
diff --git a/src/local_deep_research/web/routes/research_routes.py b/src/local_deep_research/web/routes/research_routes.py
index 16f9bf71fb..201a361586 100644
--- a/src/local_deep_research/web/routes/research_routes.py
+++ b/src/local_deep_research/web/routes/research_routes.py
@@ -1000,6 +1000,9 @@ def get_history():
.all()
)
+ # Import LibraryDocument model
+ from ...database.models.library import LibraryDocument
+
history_items = []
for research in research_records:
# Calculate duration if completed
@@ -1012,6 +1015,13 @@ def get_history():
except Exception:
logger.exception("Error calculating duration")
+ # Count documents in the library for this research
+ doc_count = (
+ db_session.query(LibraryDocument)
+ .filter_by(research_id=research.id)
+ .count()
+ )
+
# Create a history item
item = {
"id": research.id,
@@ -1023,6 +1033,7 @@ def get_history():
"duration_seconds": duration_seconds,
"report_path": research.report_path,
"metadata": research.research_meta, # Include metadata for news
+ "document_count": doc_count, # Add document count
}
# Add title if it exists
diff --git a/src/local_deep_research/web/static/js/components/history.js b/src/local_deep_research/web/static/js/components/history.js
index df42727d24..a2fd78a811 100644
--- a/src/local_deep_research/web/static/js/components/history.js
+++ b/src/local_deep_research/web/static/js/components/history.js
@@ -345,6 +345,10 @@
`<button class="btn btn-sm btn-outline view-btn">
<i class="fas fa-eye"></i> View
</button>` : ''}
+ ${item.status === 'completed' && item.document_count > 0 ?
+ `<button class="btn btn-sm btn-outline library-btn">
+ <i class="fas fa-book"></i> Library (${item.document_count})
+ </button>` : ''}
${isNewsItem && item.status === 'completed' ?
`<button class="btn btn-sm btn-outline subscribe-btn" data-research-id="${item.id}" data-query="${encodeURIComponent(item.query)}">
<i class="fas fa-bell"></i> Subscribe
@@ -364,6 +368,14 @@
});
}
+ const libraryBtn = itemEl.querySelector('.library-btn');
+ if (libraryBtn) {
+ libraryBtn.addEventListener('click', (e) => {
+ e.stopPropagation(); // Prevent item click
+ window.location.href = `/library/?research=${item.id}`;
+ });
+ }
+
const subscribeBtn = itemEl.querySelector('.subscribe-btn');
if (subscribeBtn) {
subscribeBtn.addEventListener('click', (e) => {