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 Tavily search depth dropdown showing 'undefined' values (#1088)

LearningCircuit9621af15d216
diff --git a/src/local_deep_research/__version__.py b/src/local_deep_research/__version__.py
index 530b38508e..d7e1590a54 100644
--- a/src/local_deep_research/__version__.py
+++ b/src/local_deep_research/__version__.py
@@ -1 +1 @@
-__version__ = "1.2.14"
+__version__ = "1.2.15"
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 1ce88b6efa..80e6383f8b 100644
--- a/src/local_deep_research/web/static/js/components/settings.js
+++ b/src/local_deep_research/web/static/js/components/settings.js
@@ -38,6 +38,21 @@
// Cache expiration time (24 hours in milliseconds)
const CACHE_EXPIRATION = 24 * 60 * 60 * 1000;
+ /**
+ * Escape HTML to prevent XSS attacks
+ * @param {string} unsafe - Text to escape
+ * @returns {string} Escaped text
+ */
+ function escapeHtml(unsafe) {
+ if (unsafe === null || unsafe === undefined) return '';
+ return String(unsafe)
+ .replace(/&/g, "&")
+ .replace(/</g, "&lt;")
+ .replace(/>/g, "&gt;")
+ .replace(/"/g, "&quot;")
+ .replace(/'/g, "&#039;");
+ }
+
/**
* Helper function to generate custom dropdown HTML (similar to Jinja macro)
* @param {object} params - Parameters for the dropdown
@@ -1916,19 +1931,35 @@
inputElement = renderCustomDropdownHTML(dropdownParams);
} else {
// Standard select for other keys
- inputElement = `
- <select id="${settingId}" name="${setting.key}"
- class="settings-select ldr-form-control"
- ${!setting.editable ? 'disabled' : ''}
- >
- `;
- if (setting.options) {
- setting.options.forEach(option => {
- const selected = option.value === setting.value ? 'selected' : '';
- inputElement += `<option value="${option.value}" ${selected}>${option.label || option.value}</option>`;
- });
- }
- inputElement += `</select>`;
+ const selectOptions = [];
+ if (setting.options) {
+ setting.options.forEach(option => {
+ // Handle both string options and object options
+ let optionValue, optionLabel;
+ if (typeof option === 'object' && option !== null) {
+ // Object format: {value: "basic", label: "Basic"}
+ optionValue = option.value;
+ optionLabel = option.label || option.value;
+ } else {
+ // String format: "basic"
+ optionValue = option;
+ optionLabel = option;
+ }
+ const selected = optionValue === setting.value ? 'selected' : '';
+ // Escape HTML to prevent XSS attacks
+ selectOptions.push(
+ `<option value="${escapeHtml(optionValue)}" ${selected}>${escapeHtml(optionLabel)}</option>`
+ );
+ });
+ }
+ inputElement = `
+ <select id="${settingId}" name="${setting.key}"
+ class="settings-select ldr-form-control"
+ ${!setting.editable ? 'disabled' : ''}
+ >
+ ${selectOptions.join('')}
+ </select>
+ `;
}
break;