~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix: correct data quality issues in default_settings.json (#3175)
LearningCircuit5bc7f2ad6c59
diff --git a/src/local_deep_research/defaults/default_settings.json b/src/local_deep_research/defaults/default_settings.jsonindex beac57044a..d9bc16564d 100644--- a/src/local_deep_research/defaults/default_settings.json+++ b/src/local_deep_research/defaults/default_settings.json@@ -629,7 +629,7 @@"name": "Anthropic API Key","options": null,"step": null,- "type": "SEARCH",+ "type": "LLM","ui_element": "password","value": "","visible": true@@ -643,7 +643,7 @@"name": "OpenAI API Key","options": null,"step": null,- "type": "SEARCH",+ "type": "LLM","ui_element": "password","value": "","visible": true@@ -893,8 +893,8 @@"options": null,"step": 1,"type": "SEARCH",- "ui_element": "number",- "value": 0,+ "ui_element": "checkbox",+ "value": false,"visible": true},"focused_iteration.knowledge_summary_limit": {@@ -1181,7 +1181,7 @@"step": null,"type": "SEARCH","ui_element": "select",- "value": "265",+ "value": "365","visible": true},"search.snippets_only": {@@ -4051,7 +4051,7 @@}],"step": null,- "type": "SEARCH",+ "type": "APP","ui_element": "select","value": "openai_endpoint","visible": true@@ -4065,7 +4065,7 @@"name": "Evaluation Model","options": null,"step": null,- "type": "SEARCH",+ "type": "APP","ui_element": "text","value": "anthropic/claude-3.7-sonnet","visible": true@@ -4079,7 +4079,7 @@"name": "Evaluation Endpoint URL","options": null,"step": null,- "type": "SEARCH",+ "type": "APP","ui_element": "text","value": "https://openrouter.ai/api/v1","visible": true@@ -4093,7 +4093,7 @@"name": "Evaluation Temperature","options": null,"step": 0.1,- "type": "SEARCH",+ "type": "APP","ui_element": "range","value": 0,"visible": truediff --git a/src/local_deep_research/web/static/js/components/settings.js b/src/local_deep_research/web/static/js/components/settings.jsindex a18246ad27..a8b2c7f494 100644--- a/src/local_deep_research/web/static/js/components/settings.js+++ b/src/local_deep_research/web/static/js/components/settings.js@@ -18,8 +18,6 @@let originalSettings = {};let allSettings = [];let activeTab = 'all';- let saveTimer = null;- let pendingSaves = new Set();// Model and search engine dropdown variableslet modelOptions = [];@@ -30,15 +28,6 @@let pendingSaveData = {};let lastSettingsUpdateTimestamp = 0;- // Cache keys - same as research.js for shared caching- const CACHE_KEYS = {- MODELS: 'deepResearch.availableModels',- SEARCH_ENGINES: 'deepResearch.searchEngines',- CACHE_TIMESTAMP: 'deepResearch.cacheTimestamp'- };-- // Cache expiration time (24 hours in milliseconds)- const CACHE_EXPIRATION = 24 * 60 * 60 * 1000;/*** Fallback HTML escape function (used if xss-protection.js fails to load).@@ -244,75 +233,6 @@}}- /**- * Cache data in localStorage with timestamp- * @param {string} key - The cache key- * @param {Object} data - The data to cache- */- function cacheData(key, data) {- try {- // Store the data- // Don't cache - always fetch fresh from API-- // Update or set the timestamp- let timestamps;- try {- timestamps = {}; // No cache timestamps- // Ensure timestamps is an object, not a number or other type- if (typeof timestamps !== 'object' || timestamps === null) {- timestamps = {};- }- } catch (e) {- // If parsing fails, start with a new object- timestamps = {};- }-- timestamps[key] = Date.now();- // Don't save cache timestamps-- SafeLogger.log(`Cached data for ${key}`);- } catch (error) {- SafeLogger.error('Error caching data:', error);- }- }-- /**- * Get cached data if it exists and is not expired- * @param {string} key - The cache key- * @returns {Object|null} The cached data or null if not found or expired- */- function getCachedData(key) {- try {- // Get timestamps- let timestamps;- try {- timestamps = {}; // No cache timestamps- // Ensure timestamps is an object, not a number or other type- if (typeof timestamps !== 'object' || timestamps === null) {- timestamps = {};- }- } catch (e) {- // If parsing fails, start with an empty object- timestamps = {};- }-- const timestamp = timestamps[key];-- // Check if data exists and is not expired- if (timestamp && (Date.now() - timestamp < CACHE_EXPIRATION)) {- try {- const data = null; // No cached data- return data;- } catch (e) {- SafeLogger.error('Error parsing cached data:', e);- return null;- }- }- } catch (error) {- SafeLogger.error('Error getting cached data:', error);- }- return null;- }/*** Initialize auto-save handlers for settings inputs@@ -982,11 +902,11 @@if (target) {// Set initial state - expanded- header.classList.remove('ldr-collapsed');+ header.classList.remove('collapsed');target.style.display = 'block';header.addEventListener('click', () => {- header.classList.toggle('ldr-collapsed');+ header.classList.toggle('collapsed');target.style.display = header.classList.contains('collapsed') ? 'none' : 'block';// Rotate chevron icon@@ -2111,7 +2031,7 @@<textarea id="${settingId}" name="${setting.key}"class="ldr-settings-textarea"${!setting.editable ? 'disabled' : ''}- >${setting.value !== null ? escapeHtml(setting.value) : ''}</textarea>+ >${setting.value !== null ? escapeHtml(String(setting.value)) : ''}</textarea>`;break;@@ -2140,7 +2060,7 @@<textarea id="${settingId}" name="${setting.key}"class="ldr-settings-textarea${jsonClass}"${!setting.editable ? 'disabled' : ''}- >${setting.value !== null ? escapeHtml(setting.value) : ''}</textarea>+ >${setting.value !== null ? escapeHtml(String(setting.value)) : ''}</textarea>`;break;@@ -2259,11 +2179,11 @@<div class="ldr-settings-range-container"><input type="range" id="${settingId}" name="${setting.key}"class="ldr-settings-range ldr-form-control"- value="${setting.value !== null ? escapeHtml(setting.value) : min}"+ value="${escapeHtml(String(setting.value !== null ? setting.value : min))}"min="${min}" max="${max}" step="${step}"${!setting.editable ? 'disabled' : ''}>- <span class="ldr-settings-range-value">${setting.value !== null ? escapeHtml(setting.value) : min}</span>+ <span class="ldr-settings-range-value">${escapeHtml(String(setting.value !== null ? setting.value : min))}</span></div>`;break;@@ -2276,7 +2196,7 @@inputElement = `<input type="number" id="${settingId}" name="${setting.key}"class="ldr-settings-input ldr-form-control"- value="${setting.value !== null ? escapeHtml(setting.value) : ''}"+ value="${escapeHtml(String(setting.value !== null ? setting.value : ''))}"min="${numMin}" max="${numMax}" step="${numStep}"${!setting.editable ? 'disabled' : ''}>@@ -2293,7 +2213,7 @@<input type="${setting.ui_element === 'password' ? 'password' : 'text'}"id="${settingId}" name="${setting.key}"class="ldr-settings-input ldr-form-control"- value="${setting.value !== null ? escapeHtml(setting.value) : ''}"+ value="${escapeHtml(String(setting.value !== null ? setting.value : ''))}"${!setting.editable ? 'disabled' : ''}>`;@@ -2348,13 +2268,13 @@let html = `<div class="ldr-settings-item form-group" data-key="${setting.key}"><div class="ldr-settings-item-header">- <label for="${settingId}" title="${setting.name}">- ${setting.name}+ <label for="${settingId}" title="${escapeHtml(setting.name)}">+ ${escapeHtml(setting.name)}</label></div><div class="ldr-json-expanded-controls"><input type="hidden" id="${settingId}_original" name="${setting.key}_original"- value="${JSON.stringify(jsonObj)}">+ value="${escapeHtml(JSON.stringify(jsonObj))}"><div class="ldr-json-property-controls">`;@@ -2433,7 +2353,7 @@class="ldr-settings-input ldr-form-control ldr-json-property-control"data-property="${key}"data-parent-key="${setting.key}"- value="${value}"+ value="${escapeHtml(String(value))}"${!setting.editable ? 'disabled' : ''}></div>`;@@ -2447,7 +2367,7 @@</div>${setting.description ? `<div class="ldr-input-help">- ${setting.description}+ ${escapeHtml(setting.description)}</div>` : ''}</div>@@ -3168,8 +3088,9 @@// Save the changes to apply them to UIsubmitSettingsData(flattenedConfig, null);} catch (e) {- // Show error but don't prevent hiding the editor+ // Show error and prevent hiding the editorshowAlert('Invalid JSON in editor: ' + e.message, 'error');+ return;}}@@ -3391,15 +3312,6 @@return window.modelProvidersRequestInProgress;}- const cachedData = getCachedData('deepResearch.modelProviders');- const cacheTimestamp = getCachedData('deepResearch.cacheTimestamp');-- // If not forcing refresh and we have valid cached data, use it- if (!forceRefresh && cachedData && cacheTimestamp && (Date.now() - cacheTimestamp < 3600000)) { // 1 hour cache- SafeLogger.log('Using cached model providers');- return Promise.resolve(cachedData);- }-SafeLogger.log('Fetching model providers from API');// Create a promise and store it@@ -3416,9 +3328,6 @@}).then(data => {SafeLogger.log('Got model data from API:', data);- // Cache the data for future use- cacheData('deepResearch.modelProviders', data);- cacheData('deepResearch.cacheTimestamp', Date.now());// Process the dataconst processedData = processModelData(data);@@ -3448,15 +3357,6 @@return window.searchEnginesRequestInProgress;}- const cachedData = getCachedData('deepResearch.searchEngines');- const cacheTimestamp = getCachedData('deepResearch.cacheTimestamp');-- // Use cached data if available and not forcing refresh- if (!forceRefresh && cachedData && cacheTimestamp && (Date.now() - cacheTimestamp < 3600000)) { // 1 hour cache- SafeLogger.log('Using cached search engines data');- return Promise.resolve(cachedData);- }-SafeLogger.log('Fetching search engines from API');// Create a promise and store it@@ -3469,9 +3369,6 @@}).then(data => {SafeLogger.log('Received search engine data:', data);- // Cache the data- cacheData('deepResearch.searchEngines', data);- cacheData('deepResearch.cacheTimestamp', Date.now());// Process the dataconst processedData = processSearchEngineData(data);@@ -3568,9 +3465,6 @@modelOptions = formattedModels;SafeLogger.log('Final modelOptions:', modelOptions.length, 'models');- // Cache the processed models- cacheData('deepResearch.availableModels', formattedModels);-// Return the processed modelsreturn formattedModels;}@@ -3995,41 +3889,6 @@margin-top: 8px;padding-left: 0;}-- // Add styles for the loading spinner- const spinnerStyles =- '.saving {' +- ' position: relative;' +- '}' +- '' +- '.saving:before {' +- ' content: \'\';' +- ' position: absolute;' +- ' left: -25px;' +- ' top: 50%;' +- ' transform: translateY(-50%);' +- ' width: 16px;' +- ' height: 16px;' +- ' border: 2px solid rgba(255, 255, 255, 0.3);' +- ' border-radius: 50%;' +- ' border-top-color: #fff;' +- ' animation: spinner .6s linear infinite;' +- ' z-index: 10;' +- '}' +- '' +- '.checkbox-label.saving:before {' +- ' left: -25px;' +- ' top: 50%;' +- '}' +- '' +- '@keyframes spinner {' +- ' to {transform: translateY(-50%) rotate(360deg);}' +- '}';-- // Add the styles to the head- const style = document.createElement('style');- style.textContent = spinnerStyles;- document.head.appendChild(style);`;}@@ -4643,17 +4502,6 @@* @returns {Promise} Promise that resolves with model options*/function loadModelOptions(forceRefresh = false) {- // Check if we already have cached models and haven't forced a refresh- const cachedModels = getCachedData('deepResearch.availableModels');- const cacheTimestamp = getCachedData('deepResearch.cacheTimestamp');-- if (!forceRefresh && cachedModels && Array.isArray(cachedModels) && cachedModels.length > 0 &&- cacheTimestamp && (Date.now() - cacheTimestamp < 3600000)) { // 1 hour cache- SafeLogger.log('Using cached model options, count:', cachedModels.length);- modelOptions = cachedModels;- return Promise.resolve(cachedModels);- }-SafeLogger.log('Loading model options from API' + (forceRefresh ? ' (forced refresh)' : ''));return fetchModelProviders(forceRefresh)@@ -4661,7 +4509,6 @@// Don't overwrite our model options if the result is emptyif (data && Array.isArray(data) && data.length > 0) {modelOptions = data;- cacheData('deepResearch.availableModels', data);SafeLogger.log('Stored model options, count:', data.length);} else {SafeLogger.warn('API returned empty model data, keeping existing options');diff --git a/tests/settings/golden_master_settings.json b/tests/settings/golden_master_settings.jsonindex bcf8809617..0d626669e6 100644--- a/tests/settings/golden_master_settings.json+++ b/tests/settings/golden_master_settings.json@@ -519,7 +519,7 @@"name": "Evaluation Endpoint URL","options": null,"step": null,- "type": "SEARCH",+ "type": "APP","ui_element": "text","value": "https://openrouter.ai/api/v1","visible": true@@ -533,7 +533,7 @@"name": "Evaluation Model","options": null,"step": null,- "type": "SEARCH",+ "type": "APP","ui_element": "text","value": "anthropic/claude-3.7-sonnet","visible": true@@ -564,7 +564,7 @@}],"step": null,- "type": "SEARCH",+ "type": "APP","ui_element": "select","value": "openai_endpoint","visible": true@@ -578,7 +578,7 @@"name": "Evaluation Temperature","options": null,"step": 0.1,- "type": "SEARCH",+ "type": "APP","ui_element": "range","value": 0,"visible": true@@ -677,8 +677,8 @@"options": null,"step": 1,"type": "SEARCH",- "ui_element": "number",- "value": 0,+ "ui_element": "checkbox",+ "value": false,"visible": true},"focused_iteration.knowledge_summary_limit": {@@ -832,7 +832,7 @@"name": "Anthropic API Key","options": null,"step": null,- "type": "SEARCH",+ "type": "LLM","ui_element": "password","value": "","visible": true@@ -1071,7 +1071,7 @@"name": "OpenAI API Key","options": null,"step": null,- "type": "SEARCH",+ "type": "LLM","ui_element": "password","value": "","visible": true@@ -7246,7 +7246,7 @@"step": null,"type": "SEARCH","ui_element": "select",- "value": "265",+ "value": "365","visible": true},"search.journal_reputation.threshold": {