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.

Support log download directly from the UI.

Daniel Petti05c86240dc1c
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 4b9474eb56..2c801f61ec 100644
--- a/src/local_deep_research/web/static/js/components/logpanel.js
+++ b/src/local_deep_research/web/static/js/components/logpanel.js
@@ -13,7 +13,7 @@
connectedResearchId: null, // Track which research we're connected to
currentFilter: 'all' // Track current filter type
};
-
+
/**
* Initialize the log panel
* @param {string} researchId - Optional research ID to load logs for
@@ -32,6 +32,12 @@
// If the research ID has changed, we'll update our connection
console.log('Research ID changed from', window._logPanelState.connectedResearchId, 'to', researchId);
window._logPanelState.connectedResearchId = researchId;
+ } else {
+ // Add callback for log download button.
+ const downloadButton = document.getElementById('log-download-button');
+ if (downloadButton) {
+ downloadButton.addEventListener('click', downloadLogs);
+ }
}
console.log('Initializing shared log panel, research ID:', researchId);
@@ -269,6 +275,17 @@
console.log('Log panel initialized');
}
+ /**
+ * @brief Fetches all the logs for a research instance from the API.
+ * @param researchId The ID of the research instance.
+ * @returns {Promise<any>} The logs.
+ */
+ async function fetchLogsForResearch(researchId) {
+ // Fetch logs from API
+ const response = await fetch(`/research/api/logs/${researchId}`);
+ return await response.json();
+ }
+
/**
* Load logs for a specific research
* @param {string} researchId - The research ID to load logs for
@@ -283,10 +300,7 @@
console.log('Loading logs for research ID:', researchId);
- // Fetch logs from API
- const response = await fetch(`/research/api/logs/${researchId}`);
- const data = await response.json();
-
+ const data = await fetchLogsForResearch(researchId);
console.log('Logs API response:', data);
// Initialize array to hold all logs from different sources
@@ -369,8 +383,6 @@
// Add to all logs array
allLogs.push(logEntry);
});
-
- lastLogContents = allLogs;
}
} catch (e) {
console.error('Error parsing progress_log:', e);
@@ -610,7 +622,7 @@
*/
function addLogEntryToPanel(logEntry, incrementCounter = true) {
console.log('Adding log entry to panel:', logEntry);
-
+
const consoleLogContainer = document.getElementById('console-log-container');
if (!consoleLogContainer) {
console.warn('Console log container not found');
@@ -917,22 +929,21 @@
* saved logs to the user's computer.
*/
function downloadLogs() {
- // Get all console log entries from the DOM
- const logEntries = document.querySelectorAll('.console-log-entry');
-
- // Create a blob with the logs data
- const blob = new Blob([JSON.stringify(logs, null, 2)], { type: 'application/json' });
-
- // Create a link element and trigger download
- const url = URL.createObjectURL(blob);
- const a = document.createElement('a');
- a.href = url;
- a.download = 'logs.json';
- document.body.appendChild(a);
- a.click();
- document.body.removeChild(a);
- URL.revokeObjectURL(url);
-
+ const researchId = window._logPanelState.connectedResearchId;
+ fetchLogsForResearch(researchId).then((logData) => {
+ // Create a blob with the logs data
+ const blob = new Blob([JSON.stringify(logData, null, 2)], { type: 'application/json' });
+
+ // Create a link element and trigger download
+ const url = URL.createObjectURL(blob);
+ const a = document.createElement('a');
+ a.href = url;
+ a.download = `research_logs_${researchId}.json`;
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ URL.revokeObjectURL(url);
+ });
}
// Expose public API