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: Restore original saveResearchSettings functionality

LearningCircuitf2f2367da4c9
diff --git a/src/local_deep_research/web/static/js/research_form.js b/src/local_deep_research/web/static/js/research_form.js
index 49d6adf9d2..dac4e8e865 100644
--- a/src/local_deep_research/web/static/js/research_form.js
+++ b/src/local_deep_research/web/static/js/research_form.js
@@ -14,6 +14,10 @@ document.addEventListener('DOMContentLoaded', function() {
* Initialize the research form with values from settings
*/
function initResearchForm() {
+ // Get form elements
+ const iterationsInput = document.getElementById('iterations');
+ const questionsInput = document.getElementById('questions_per_iteration');
+
// Fetch all settings at once (more efficient)
fetch(URLS.SETTINGS_API.BASE)
.then(response => {
@@ -30,6 +34,18 @@ function initResearchForm() {
// Cache settings globally for warning logic
globalSettings = settings;
+ // Look for the iterations setting
+ for (const key in settings) {
+ const setting = settings[key];
+ if (key === 'search.iterations' && iterationsInput) {
+ iterationsInput.value = setting.value;
+ }
+
+ if (key === 'search.questions_per_iteration' && questionsInput) {
+ questionsInput.value = setting.value;
+ }
+ }
+
// Initialize warnings after settings are loaded
initializeWarnings();
}
@@ -61,11 +77,46 @@ function patchFormSubmitHandler() {
/**
* Save research settings to the database
- * Note: Iterations and questions are now only configured in Settings page
*/
function saveResearchSettings() {
- // Settings are now managed through the Settings page only
- // This function is kept for compatibility but no longer saves iterations/questions
+ const iterationsInput = document.getElementById('iterations');
+ const questionsInput = document.getElementById('questions_per_iteration');
+
+ // Only save if the elements exist (not on follow-up modal)
+ if (!iterationsInput || !questionsInput) {
+ return;
+ }
+
+ const iterations = iterationsInput.value;
+ const questions = questionsInput.value;
+
+ // Get CSRF token
+ const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');
+
+ if (!csrfToken) {
+ console.warn('CSRF token not found, skipping settings save');
+ return;
+ }
+
+ // Save settings
+ fetch(URLS.SETTINGS_API.SAVE_ALL_SETTINGS, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'X-CSRFToken': csrfToken
+ },
+ body: JSON.stringify({
+ 'search.iterations': parseInt(iterations),
+ 'search.questions_per_iteration': parseInt(questions)
+ })
+ })
+ .then(response => response.json())
+ .then(data => {
+ console.log('Research settings saved');
+ })
+ .catch(error => {
+ console.error('Error saving research settings:', error);
+ });
}
/**