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 the issue where the total number of logs is zero on page load.

Daniel Petti508d8b2a49f7
diff --git a/src/local_deep_research/web/models/database.py b/src/local_deep_research/web/models/database.py
index a3ba8f7b91..f20f4920dc 100644
--- a/src/local_deep_research/web/models/database.py
+++ b/src/local_deep_research/web/models/database.py
@@ -247,3 +247,23 @@ def get_logs_for_research(research_id):
except Exception:
logger.exception("Error retrieving logs from database")
return []
+
+
+def get_total_logs_for_research(research_id):
+ """
+ Returns the total number of logs for a given `research_id`.
+
+ Args:
+ research_id (int): The ID of the research.
+
+ Returns:
+ int: Total number of logs for the specified research ID.
+ """
+ session = get_db_session()
+ total_logs = (
+ session.query(ResearchLog)
+ .filter(ResearchLog.research_id == research_id)
+ .count()
+ )
+ return total_logs
diff --git a/src/local_deep_research/web/routes/history_routes.py b/src/local_deep_research/web/routes/history_routes.py
index f5ab23f0c1..cfe467191a 100644
--- a/src/local_deep_research/web/routes/history_routes.py
+++ b/src/local_deep_research/web/routes/history_routes.py
@@ -5,7 +5,11 @@ from pathlib import Path
from flask import Blueprint, jsonify, make_response
-from ..models.database import get_db_connection, get_logs_for_research
+from ..models.database import (
+ get_db_connection,
+ get_logs_for_research,
+ get_total_logs_for_research,
+)
from ..routes.globals import get_globals
# Initialize logger
@@ -342,3 +346,12 @@ def get_research_logs(research_id):
formatted_logs.append(log_entry)
return jsonify({"status": "success", "logs": formatted_logs})
+
+
+@history_bp.route("/log_count/<int:research_id>")
+def get_log_count(research_id):
+ """Get the total number of logs for a specific research ID"""
+ # Get the total number of logs for this research ID
+ total_logs = get_total_logs_for_research(research_id)
+
+ return jsonify({"status": "success", "total_logs": total_logs})
diff --git a/src/local_deep_research/web/static/js/components/logpanel.js b/src/local_deep_research/web/static/js/components/logpanel.js
index 2c801f61ec..25d163fcc0 100644
--- a/src/local_deep_research/web/static/js/components/logpanel.js
+++ b/src/local_deep_research/web/static/js/components/logpanel.js
@@ -197,6 +197,23 @@
logIndicators.forEach(indicator => {
indicator.textContent = '0';
});
+
+ // Fetch the log count from the API and update the indicators
+ fetch(`/research/api/log_count/${researchId}`)
+ .then(response => response.json())
+ .then(data => {
+ console.log('Log count data:', data);
+ if (data && typeof data.total_logs === 'number') {
+ logIndicators.forEach(indicator => {
+ indicator.textContent = data.total_logs;
+ });
+ } else {
+ console.error('Invalid log count data received from API');
+ }
+ })
+ .catch(error => {
+ console.error('Error fetching log count:', error);
+ });
} else {
console.warn('No log indicators found for initialization');
}