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: Add View Results button functionality to research details page (#438)

LearningCircuit4956e76aa9f2
diff --git a/src/local_deep_research/web/routes/research_routes.py b/src/local_deep_research/web/routes/research_routes.py
index 21d83b6590..1d575565b0 100644
--- a/src/local_deep_research/web/routes/research_routes.py
+++ b/src/local_deep_research/web/routes/research_routes.py
@@ -727,6 +727,70 @@ def get_research_logs(research_id):
return jsonify({"error": "An internal error has occurred"}), 500
+@research_bp.route("/api/report/<int:research_id>")
+def get_research_report(research_id):
+ """Get the research report content"""
+ from ..database.models import Research
+ from ...utilities.db_utils import get_db_session
+
+ session = get_db_session()
+ try:
+ # Query using ORM
+ research = session.query(Research).filter_by(id=research_id).first()
+
+ if research is None:
+ return jsonify({"error": "Research not found"}), 404
+
+ # Parse metadata if it exists
+ metadata = {}
+ if research.metadata:
+ try:
+ metadata = json.loads(research.metadata)
+ except json.JSONDecodeError:
+ logger.warning(
+ f"Invalid JSON in metadata for research {research_id}"
+ )
+
+ # Check if report file exists
+ if not research.report_path or not os.path.exists(research.report_path):
+ return jsonify({"error": "Report file not found"}), 404
+
+ # Read the report content
+ try:
+ with open(research.report_path, "r", encoding="utf-8") as f:
+ content = f.read()
+ except Exception as e:
+ logger.error(
+ f"Error reading report file {research.report_path}: {e}"
+ )
+ return jsonify({"error": "Error reading report file"}), 500
+
+ # Return the report data
+ return jsonify(
+ {
+ "content": content,
+ "metadata": {
+ "query": research.query,
+ "mode": research.mode.value if research.mode else None,
+ "created_at": research.created_at.isoformat()
+ if research.created_at
+ else None,
+ "completed_at": research.completed_at.isoformat()
+ if research.completed_at
+ else None,
+ "report_path": research.report_path,
+ **metadata,
+ },
+ }
+ )
+
+ except Exception as e:
+ logger.exception(f"Error getting research report: {str(e)}")
+ return jsonify({"error": "An internal error has occurred"}), 500
+ finally:
+ session.close()
+
+
@research_bp.route("/api/research/<research_id>/status")
def get_research_status(research_id):
"""Get the status of a research process"""
diff --git a/src/local_deep_research/web/static/js/components/details.js b/src/local_deep_research/web/static/js/components/details.js
index c15382db9a..e565a26ffe 100644
--- a/src/local_deep_research/web/static/js/components/details.js
+++ b/src/local_deep_research/web/static/js/components/details.js
@@ -731,6 +731,14 @@
// Load research metrics
loadResearchMetrics();
+ // View Results button
+ const viewResultsBtn = document.getElementById('view-results-btn');
+ if (viewResultsBtn) {
+ viewResultsBtn.addEventListener('click', () => {
+ window.location.href = `/research/results/${researchId}`;
+ });
+ }
+
// Back button
const backBtn = document.getElementById('back-to-history');
if (backBtn) {