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.

Improve log panel UI (#584)

Daniel Pettia97a951dafd7
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 0473cb117d..12621959f3 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -10,4 +10,4 @@
# - Exploring options to provide free public hosting of LDR
github: [LearningCircuit, djpetti, hashedviking] # GitHub Sponsors for individual contributors
-ko_fi: localdeepresearch # Support the project with one-time donations
\ No newline at end of file
+ko_fi: localdeepresearch # Support the project with one-time donations
diff --git a/src/local_deep_research/web/services/settings_manager.py b/src/local_deep_research/web/services/settings_manager.py
index 2d67c0c081..2df5ed6fe0 100644
--- a/src/local_deep_research/web/services/settings_manager.py
+++ b/src/local_deep_research/web/services/settings_manager.py
@@ -66,6 +66,11 @@ class SettingsManager:
self.db_session = db_session
self.db_first = True # Always prioritize DB settings
+ # Check if we should lock all the settings.
+ self.__settings_locked = self.get_setting("app.lock_settings", False)
+ if self.__settings_locked:
+ logger.info("Settings are locked. Disabling all settings changes.")
+
@property
def default_settings(self) -> Dict[str, Any]:
"""
@@ -78,11 +83,6 @@ class SettingsManager:
)
return json.loads(default_settings)
- # Check if we should lock all the settings.
- self.__settings_locked = self.get_setting("app.lock_settings", False)
- if self.__settings_locked:
- logger.info("Settings are locked. Disabling all settings changes.")
-
def __get_typed_setting_value(
self,
setting: Type[Setting],
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 1397a356b4..5f446ce8ad 100644
--- a/src/local_deep_research/web/static/js/components/logpanel.js
+++ b/src/local_deep_research/web/static/js/components/logpanel.js
@@ -11,7 +11,8 @@
logCount: 0,
initialized: false, // Track initialization state
connectedResearchId: null, // Track which research we're connected to
- currentFilter: 'all' // Track current filter type
+ currentFilter: 'all', // Track current filter type
+ autoscroll: true, // Track whether autoscroll is enabled.
};
/**
@@ -77,6 +78,8 @@
return;
}
+ const autoscrollButton = document.querySelector('#log-autoscroll-button');
+
// Handle visibility based on page type
if (!isResearchPage) {
console.log('Not on a research-specific page, hiding log panel');
@@ -137,36 +140,65 @@
logPanelContent.classList.toggle('collapsed');
logPanelToggle.classList.toggle('collapsed');
- // Update toggle icon
+ const collapsed = logPanelContent.classList.contains('collapsed');
+
const toggleIcon = logPanelToggle.querySelector('.toggle-icon');
- if (toggleIcon) {
- if (logPanelContent.classList.contains('collapsed')) {
- toggleIcon.className = 'fas fa-chevron-right toggle-icon';
- } else {
- toggleIcon.className = 'fas fa-chevron-down toggle-icon';
-
- // Load logs if not already loaded
- if (!logPanelContent.dataset.loaded && researchId) {
- console.log('First expansion of log panel, loading logs');
- loadLogsForResearch(researchId);
- logPanelContent.dataset.loaded = 'true';
- }
+ if (toggleIcon && !collapsed) {
+ // Load logs if not already loaded
+ if (!logPanelContent.dataset.loaded && researchId) {
+ console.log('First expansion of log panel, loading logs');
+ loadLogsForResearch(researchId);
+ logPanelContent.dataset.loaded = 'true';
+ }
- // Process any queued logs
- if (window._logPanelState.queuedLogs.length > 0) {
- console.log(`Processing ${window._logPanelState.queuedLogs.length} queued logs`);
- window._logPanelState.queuedLogs.forEach(logEntry => {
- addLogEntryToPanel(logEntry);
- });
- window._logPanelState.queuedLogs = [];
- }
+ // Process any queued logs
+ if (window._logPanelState.queuedLogs.length > 0) {
+ console.log(`Processing ${window._logPanelState.queuedLogs.length} queued logs`);
+ window._logPanelState.queuedLogs.forEach(logEntry => {
+ addLogEntryToPanel(logEntry);
+ });
+ window._logPanelState.queuedLogs = [];
+ }
+ }
+
+ // Default to showing the autoscroll button.
+ if (autoscrollButton !== null) {
+ autoscrollButton.style.display = 'inline';
+ }
+
+ const logPanel = document.querySelector('.collapsible-log-panel');
+ const progressHeader = document.querySelector('#research-progres-header');
+ const progressCard = document.querySelector('#research-progress-card');
+ if (!collapsed && logPanel !== null && progressCard !== null && progressHeader !== null) {
+ // Set the height of the log panel to occupy all the screen
+ // real-estate that's not currently being used by the `research-progress`
+ // component.
+ // We add a little extra space to account for margins.
+ logPanel.style.height = `calc(100vh - 96px - ${getComputedStyle(progressCard).height} - ${getComputedStyle(progressHeader).height})`;
+
+ // Start with autoscroll on when expanding.
+ window._logPanelState.autoscroll = false;
+ toggleAutoscroll();
+ } else if (logPanel !== null) {
+ // Use the default height.
+ logPanel.style.height = 'auto';
+ // Hide the autoscroll button since it doesn't make
+ // sense in this context.
+ if (autoscrollButton !== null) {
+ autoscrollButton.style.display = 'none';
}
}
// Track expanded state
- window._logPanelState.expanded = !logPanelContent.classList.contains('collapsed');
+ window._logPanelState.expanded = !collapsed;
});
+ if (autoscrollButton) {
+ // Set up autoscroll handler for the log panel. When autoscroll is
+ // enabled, it will automatically scroll as new logs are added.
+ autoscrollButton.addEventListener('click', toggleAutoscroll);
+ }
+
// Set up filter button click handlers
const filterButtons = document.querySelectorAll('.log-filter .filter-buttons button');
filterButtons.forEach(button => {
@@ -292,6 +324,30 @@
console.log('Log panel initialized');
}
+ /**
+ * @brief Toggles autoscroll on or off.
+ */
+ function toggleAutoscroll() {
+ window._logPanelState.autoscroll = !window._logPanelState.autoscroll;
+
+ const autoscrollButton = document.querySelector('#log-autoscroll-button');
+ const consoleLogContainer = document.getElementById('console-log-container');
+ if (!autoscrollButton || !consoleLogContainer) {
+ console.error("Autoscroll button or console log container not found.");
+ return;
+ }
+
+ // Highlight the autoscroll button in purple when it's
+ // enabled to make that clear.
+ if (window._logPanelState.autoscroll) {
+ autoscrollButton.classList.add('selected');
+ // Immediately scroll to the bottom of the panel.
+ consoleLogContainer.scrollTop = consoleLogContainer.scrollHeight;
+ } else {
+ autoscrollButton.classList.remove('selected');
+ }
+ }
+
/**
* @brief Fetches all the logs for a research instance from the API.
* @param researchId The ID of the research instance.
@@ -832,7 +888,7 @@
// No need to scroll when loading all logs
// Scroll will be handled after all logs are loaded
- if (incrementCounter) {
+ if (incrementCounter && window._logPanelState.autoscroll) {
// Auto-scroll to newest log (at the bottom)
setTimeout(() => {
consoleLogContainer.scrollTop = consoleLogContainer.scrollHeight;
diff --git a/src/local_deep_research/web/templates/components/log_panel.html b/src/local_deep_research/web/templates/components/log_panel.html
index 88e83cfb14..cb2d8dc604 100644
--- a/src/local_deep_research/web/templates/components/log_panel.html
+++ b/src/local_deep_research/web/templates/components/log_panel.html
@@ -16,9 +16,14 @@
</div>
</div>
<div class="log-download">
- <button class="small-btn download-btn" id="log-download-button">
+ <button class="small-btn" id="log-download-button">
<i class="fas fa-download"></i> Download Logs
</button>
+ <button class="small-btn selected"
+ id="log-autoscroll-button"
+ title="Toggle automatic scrolling of logs">
+ <i class="fas fa-arrows-alt-v"></i>
+ </button>
</div>
</div>
<div class="console-log" id="console-log-container">
diff --git a/src/local_deep_research/web/templates/pages/progress.html b/src/local_deep_research/web/templates/pages/progress.html
index 6a9f978ac5..c9ab539a5a 100644
--- a/src/local_deep_research/web/templates/pages/progress.html
+++ b/src/local_deep_research/web/templates/pages/progress.html
@@ -4,10 +4,10 @@
{% block content %}
<div class="page active" id="research-progress">
- <div class="page-header">
+ <div class="page-header" id="research-progres-header">
<h1>Research in Progress</h1>
</div>
- <div class="card">
+ <div class="card" id="research-progress-card">
<div class="card-content">
<div class="progress-info">
<div class="current-query-container">