~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
refactor: simplify settings loader per review feedback
LearningCircuitc39a330bf38a
diff --git a/src/local_deep_research/web/services/settings_manager.py b/src/local_deep_research/web/services/settings_manager.pyindex 8fd94a0d59..738e8c232e 100644--- a/src/local_deep_research/web/services/settings_manager.py+++ b/src/local_deep_research/web/services/settings_manager.py@@ -1,4 +1,3 @@-import importlib.resources as pkg_resourcesimport jsonimport osimport threading@@ -112,75 +111,46 @@ class SettingsManager:"""settings = {}- # Load main settings file first (if it exists)- try:- main_settings = pkg_resources.read_text(- defaults, "default_settings.json"- )- settings.update(json.loads(main_settings))- logger.debug("Loaded main default_settings.json")- except Exception as e:- logger.info(- f"No main default_settings.json found (this is OK): {e}"- )-- # Get the defaults package pathtry:+ # Get the defaults package pathdefaults_path = Path(defaults.__file__).parent- # Recursively find and load all JSON files in the defaults directory- # excluding the main default_settings.json which we already loaded- json_files = []+ # Find all JSON files recursively in the defaults directory+ json_files = list(defaults_path.rglob("*.json"))- # Check if settings subdirectory exists- settings_dir = defaults_path / "settings"- if settings_dir.exists():- # Use rglob to recursively find all .json files- json_files = list(settings_dir.rglob("*.json"))+ # Sort for consistent loading order+ json_files.sort()- # Sort files to ensure consistent loading order- json_files.sort()+ logger.info(f"Found {len(json_files)} JSON settings files")- logger.info(- f"Found {len(json_files)} additional JSON settings files to load"- )+ # Load and merge all JSON files+ for json_file in json_files:+ try:+ with open(json_file, "r") as f:+ file_settings = json.load(f)- # Load each JSON file and merge into settings- for json_file in json_files:- try:- with open(json_file, "r") as f:- file_settings = json.load(f)-- # Get relative path for logging- relative_path = json_file.relative_to(defaults_path)-- # Check for key conflicts- conflicts = set(settings.keys()) & set(- file_settings.keys()- )- if conflicts:- logger.warning(- f"Keys {conflicts} from {relative_path} will override existing values"- )-- settings.update(file_settings)- logger.debug(- f"Loaded settings from {relative_path}"- )-- except json.JSONDecodeError:- logger.exception(f"Invalid JSON in {json_file}")- except Exception as e:- logger.warning(f"Could not load {json_file}: {e}")- else:- logger.debug(- "No settings subdirectory found, using only main settings file"- )+ # Get relative path for logging+ relative_path = json_file.relative_to(defaults_path)++ # Warn about key conflicts+ conflicts = set(settings.keys()) & set(file_settings.keys())+ if conflicts:+ logger.warning(+ f"Keys {conflicts} from {relative_path} override existing values"+ )++ settings.update(file_settings)+ logger.debug(f"Loaded {relative_path}")++ except json.JSONDecodeError:+ logger.exception(f"Invalid JSON in {json_file}")+ except Exception as e:+ logger.warning(f"Could not load {json_file}: {e}")except Exception as e:- logger.warning(f"Error loading modular settings files: {e}")+ logger.warning(f"Error loading settings files: {e}")- logger.info(f"Loaded total of {len(settings)} settings")+ logger.info(f"Loaded {len(settings)} total settings")return settingsdef __get_typed_setting_value(