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.

Revert "fix(settings): handle unchecked checkboxes in settings forms"

LearningCircuit7df8a9a39ec6
diff --git a/src/local_deep_research/__version__.py b/src/local_deep_research/__version__.py
index b7e1990493..b3f9ac7f1a 100644
--- a/src/local_deep_research/__version__.py
+++ b/src/local_deep_research/__version__.py
@@ -1 +1 @@
-__version__ = "1.2.5"
+__version__ = "1.2.4"
diff --git a/src/local_deep_research/web/routes/settings_routes.py b/src/local_deep_research/web/routes/settings_routes.py
index 7c2b306ac9..942ecb3e54 100644
--- a/src/local_deep_research/web/routes/settings_routes.py
+++ b/src/local_deep_research/web/routes/settings_routes.py
@@ -46,61 +46,6 @@ def _get_setting_from_session(key: str, default=None):
return default
-def normalize_checkbox_form_data(all_settings, form_data):
- """
- Normalize checkbox form data to handle HTML form behavior where unchecked checkboxes
- are not included in form submission.
-
- Args:
- all_settings: Dictionary of all settings from settings manager
- form_data: Dictionary of form data from request
-
- Returns:
- Updated form_data dictionary with normalized checkbox values
- """
- # Handle error cases
- if all_settings is None:
- logger.warning("all_settings is None in normalize_checkbox_form_data")
- return form_data
-
- if not isinstance(all_settings, dict):
- logger.warning(
- f"all_settings has unexpected type: {type(all_settings)}"
- )
- return form_data
-
- if form_data is None:
- logger.warning("form_data is None in normalize_checkbox_form_data")
- return {}
-
- if not isinstance(form_data, dict):
- logger.warning(f"form_data has unexpected type: {type(form_data)}")
- return {}
-
- try:
- # Handle all checkboxes consistently
- for key, setting_data in all_settings.items():
- if not isinstance(setting_data, dict):
- logger.warning(
- f"Setting data for key '{key}' is not a dict: {type(setting_data)}"
- )
- continue
-
- if setting_data.get("ui_element") == "checkbox":
- if key not in form_data:
- # Checkbox was not in form data (unchecked), set to False
- form_data[key] = False
- else:
- # Checkbox was in form data, convert to boolean
- form_data[key] = form_data[key] == "on"
- except Exception:
- logger.exception("Error in normalize_checkbox_form_data")
- # Return the original form_data if processing fails
- return form_data
-
- return form_data
-
-
def calculate_warnings():
"""Calculate current warning conditions based on settings"""
warnings = []
@@ -249,30 +194,17 @@ def save_all_settings():
# get_db_settings_manager(db_session)
try:
- # Try to process JSON data first (expected from JavaScript)
+ # Process JSON data
form_data = request.get_json()
-
- # If no JSON data, fall back to form data (traditional form submission)
if not form_data:
- logger.info("No JSON data received, falling back to form data")
- form_data = request.form.to_dict()
- # Remove CSRF token from the data
- form_data.pop("csrf_token", None)
-
- # Handle checkbox settings specifically for traditional form submission
- # When unchecked, they won't be in form_data, so we need to explicitly set them to False
- settings_manager = SettingsManager(db_session)
-
- # Get all settings
- all_settings = settings_manager.get_all_settings()
-
- # Normalize checkbox form data using shared helper
- form_data = normalize_checkbox_form_data(
- all_settings, form_data
- )
-
- logger.info(
- f"Processed form data with {len(form_data)} settings"
+ return (
+ jsonify(
+ {
+ "status": "error",
+ "message": "No settings data provided",
+ }
+ ),
+ 400,
)
# Track validation errors
@@ -371,11 +303,6 @@ def save_all_settings():
pass
if current_setting:
- # Check if setting is editable before attempting to save
- if not current_setting.editable:
- logger.warning(f"Skipping non-editable setting: {key}")
- continue
-
# Validate the setting
is_valid, error_message = validate_setting(
current_setting, value
@@ -547,11 +474,6 @@ def save_all_settings():
f"Bulk settings update affected warning keys, calculated {len(warnings)} warnings"
)
- # Sync server config with updated settings
- settings_manager = SettingsManager(db_session)
- settings_snapshot = settings_manager.get_settings_snapshot()
- sync_from_settings(settings_snapshot)
-
return jsonify(response_data)
except Exception:
@@ -616,18 +538,15 @@ def save_settings():
updated_count = 0
failed_count = 0
- # Handle checkbox settings specifically
- # When unchecked, they won't be in form_data, so we need to explicitly set them to False
-
- # Get all settings
- all_settings = settings_manager.get_all_settings()
-
- # Normalize checkbox form data using shared helper
- form_data = normalize_checkbox_form_data(all_settings, form_data)
-
# Process each setting
for key, value in form_data.items():
try:
+ # Handle checkbox values
+ if value == "on":
+ value = True
+ elif value == "off" or value == "":
+ value = False
+
# Try to convert numeric values
if (
isinstance(value, str)
@@ -641,16 +560,6 @@ def save_settings():
except ValueError:
pass # Keep as string
- # Check if setting is editable before attempting to save
- current_setting = (
- db_session.query(Setting)
- .filter(Setting.key == key)
- .first()
- )
- if current_setting and not current_setting.editable:
- logger.warning(f"Skipping non-editable setting: {key}")
- continue
-
# Save the setting
if settings_manager.set_setting(key, value, commit=False):
updated_count += 1
@@ -1966,8 +1875,6 @@ def fix_corrupted_settings():
default_value = 5000
elif setting.key == "app.debug":
default_value = True
- elif setting.key == "app.allow_registrations":
- default_value = True
# Update the setting with the default value if found
if default_value is not None:
diff --git a/src/local_deep_research/web/static/js/components/settings.js b/src/local_deep_research/web/static/js/components/settings.js
index 6e9a711e6d..1ce88b6efa 100644
--- a/src/local_deep_research/web/static/js/components/settings.js
+++ b/src/local_deep_research/web/static/js/components/settings.js
@@ -1130,14 +1130,13 @@
'dark_mode',
'default_theme',
'theme',
- 'warnings',
- 'allow_registrations'
+ 'warnings'
]
};
// Priority settings that should appear at the top of each tab
const prioritySettings = {
- 'app': ['enable_web', 'enable_notifications', 'web_interface', 'theme', 'default_theme', 'dark_mode', 'debug', 'host', 'port', 'warnings', 'allow_registrations'],
+ 'app': ['enable_web', 'enable_notifications', 'web_interface', 'theme', 'default_theme', 'dark_mode', 'debug', 'host', 'port', 'warnings'],
'llm': ['provider', 'model', 'temperature', 'max_tokens', 'api_key', 'openai_endpoint_url', 'lmstudio_url', 'llamacpp_model_path'],
'search': ['tool', 'iterations', 'questions_per_iteration', 'max_results', 'region', 'search_engine'],
'report': ['enable_fact_checking', 'knowledge_accumulation', 'output_dir', 'detailed_citations']