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.

feat(ui): add LM Studio URL and context window settings to research page

LearningCircuitf110360ef697
diff --git a/src/local_deep_research/web/app_factory.py b/src/local_deep_research/web/app_factory.py
index c6d3c6cf9d..a4716326ae 100644
--- a/src/local_deep_research/web/app_factory.py
+++ b/src/local_deep_research/web/app_factory.py
@@ -454,6 +454,12 @@ def register_blueprints(app):
"llm_ollama_url": settings_manager.get_setting(
"llm.ollama.url", "http://localhost:11434"
),
+ "llm_lmstudio_url": settings_manager.get_setting(
+ "llm.lmstudio.url", "http://localhost:1234"
+ ),
+ "llm_local_context_window_size": settings_manager.get_setting(
+ "llm.local_context_window_size", 4096
+ ),
"search_tool": settings_manager.get_setting(
"search.tool", ""
),
diff --git a/src/local_deep_research/web/static/js/components/research.js b/src/local_deep_research/web/static/js/components/research.js
index 7d6ef5abed..30281ae4bd 100644
--- a/src/local_deep_research/web/static/js/components/research.js
+++ b/src/local_deep_research/web/static/js/components/research.js
@@ -15,6 +15,10 @@
let endpointContainer = null;
let ollamaUrlInput = null;
let ollamaUrlContainer = null;
+ let lmstudioUrlInput = null;
+ let lmstudioUrlContainer = null;
+ let contextWindowInput = null;
+ let contextWindowContainer = null;
let modelInput = null;
let modelDropdown = null;
let modelDropdownList = null;
@@ -100,6 +104,10 @@
endpointContainer = document.getElementById('endpoint_container');
ollamaUrlInput = document.getElementById('ollama_url');
ollamaUrlContainer = document.getElementById('ollama_url_container');
+ lmstudioUrlInput = document.getElementById('lmstudio_url');
+ lmstudioUrlContainer = document.getElementById('lmstudio_url_container');
+ contextWindowInput = document.getElementById('context_window');
+ contextWindowContainer = document.getElementById('context_window_container');
// Custom dropdown elements
modelInput = document.getElementById('model');
@@ -623,6 +631,17 @@
ollamaUrlContainer.style.display = provider === 'OLLAMA' ? 'block' : 'none';
}
+ // Show LM Studio URL input if LMSTUDIO is selected
+ if (lmstudioUrlContainer) {
+ lmstudioUrlContainer.style.display = provider === 'LMSTUDIO' ? 'block' : 'none';
+ }
+
+ // Show context window for local providers (OLLAMA or LMSTUDIO)
+ if (contextWindowContainer) {
+ const isLocalProvider = provider === 'OLLAMA' || provider === 'LMSTUDIO';
+ contextWindowContainer.style.display = isLocalProvider ? 'block' : 'none';
+ }
+
// Update model options based on provider
// Don't reset model selection - preserve it if valid for new provider
updateModelOptionsForProvider(provider, false);
@@ -678,6 +697,33 @@
});
}
+ // LM Studio URL change - save to settings manager
+ if (lmstudioUrlInput) {
+ lmstudioUrlInput.addEventListener('change', function() {
+ const url = this.value;
+ console.log('LM Studio URL changed to:', url);
+ saveSearchSetting('llm.lmstudio.url', url);
+ });
+ }
+
+ // Context window size change - save to settings manager
+ if (contextWindowInput) {
+ contextWindowInput.addEventListener('change', function() {
+ const size = parseInt(this.value);
+ console.log('Context window size changed to:', size);
+ saveSearchSetting('llm.local_context_window_size', size);
+ });
+ }
+
+ // Ollama URL change - save to settings manager
+ if (ollamaUrlInput) {
+ ollamaUrlInput.addEventListener('change', function() {
+ const url = this.value;
+ console.log('Ollama URL changed to:', url);
+ saveSearchSetting('llm.ollama.url', url);
+ });
+ }
+
// Load options data from APIs
Promise.all([
loadModelOptions(false),
@@ -767,6 +813,19 @@
ollamaUrlContainer.style.display = selectedProvider === 'OLLAMA' ? 'block' : 'none';
}
+ // Show LM Studio URL input if LMSTUDIO is selected
+ if (lmstudioUrlContainer) {
+ const selectedProvider = modelProviderSelect.value || initialProvider.toUpperCase();
+ lmstudioUrlContainer.style.display = selectedProvider === 'LMSTUDIO' ? 'block' : 'none';
+ }
+
+ // Show context window for local providers (OLLAMA or LMSTUDIO)
+ if (contextWindowContainer) {
+ const selectedProvider = modelProviderSelect.value || initialProvider.toUpperCase();
+ const isLocalProvider = selectedProvider === 'OLLAMA' || selectedProvider === 'LMSTUDIO';
+ contextWindowContainer.style.display = isLocalProvider ? 'block' : 'none';
+ }
+
// Initial update of model options
const providerToUpdate = modelProviderSelect.value || initialProvider.toUpperCase();
updateModelOptionsForProvider(providerToUpdate);
@@ -1331,6 +1390,18 @@
ollamaUrlContainer.style.display =
providerValue === 'OLLAMA' ? 'block' : 'none';
}
+
+ // Display LM Studio URL container if using LMSTUDIO
+ if (lmstudioUrlContainer) {
+ lmstudioUrlContainer.style.display =
+ providerValue === 'LMSTUDIO' ? 'block' : 'none';
+ }
+
+ // Display context window container for local providers
+ if (contextWindowContainer) {
+ const isLocalProvider = providerValue === 'OLLAMA' || providerValue === 'LMSTUDIO';
+ contextWindowContainer.style.display = isLocalProvider ? 'block' : 'none';
+ }
}
// Update the custom endpoint URl if we have one.
@@ -1350,6 +1421,24 @@
ollamaUrlInput.disabled = !ollamaUrlSetting.editable;
}
+ // Update the LM Studio URL if we have one
+ const lmstudioUrlSetting = data.settings['llm.lmstudio.url'];
+ if (lmstudioUrlSetting && lmstudioUrlInput) {
+ const lmstudioUrlValue = lmstudioUrlSetting.value;
+ console.log('Current LM Studio URL:', lmstudioUrlValue);
+ lmstudioUrlInput.value = lmstudioUrlValue;
+ lmstudioUrlInput.disabled = !lmstudioUrlSetting.editable;
+ }
+
+ // Update the context window size if we have one
+ const contextWindowSetting = data.settings['llm.local_context_window_size'];
+ if (contextWindowSetting && contextWindowInput) {
+ const contextWindowValue = contextWindowSetting.value;
+ console.log('Current context window size:', contextWindowValue);
+ contextWindowInput.value = contextWindowValue;
+ contextWindowInput.disabled = !contextWindowSetting.editable;
+ }
+
// Load model options based on the current provider
const currentProvider = modelProviderSelect ? modelProviderSelect.value : 'OLLAMA';
updateModelOptionsForProvider(currentProvider, false).then(() => {
@@ -1526,6 +1615,16 @@
ollamaUrlContainer.style.display =
provider === 'OLLAMA' ? 'block' : 'none';
}
+ // Show/hide LM Studio URL input if needed
+ if (lmstudioUrlContainer) {
+ lmstudioUrlContainer.style.display =
+ provider === 'LMSTUDIO' ? 'block' : 'none';
+ }
+ // Show/hide context window for local providers
+ if (contextWindowContainer) {
+ const isLocalProvider = provider === 'OLLAMA' || provider === 'LMSTUDIO';
+ contextWindowContainer.style.display = isLocalProvider ? 'block' : 'none';
+ }
}
const currentProvider = modelProviderSelect ? modelProviderSelect.value : 'OLLAMA';
diff --git a/src/local_deep_research/web/templates/pages/research.html b/src/local_deep_research/web/templates/pages/research.html
index 4775f9e751..f8b3f739c0 100644
--- a/src/local_deep_research/web/templates/pages/research.html
+++ b/src/local_deep_research/web/templates/pages/research.html
@@ -101,6 +101,20 @@
<input type="text" id="ollama_url" name="ollama_url" class="ldr-form-control" placeholder="http://localhost:11434" value="{{ settings.llm_ollama_url }}">
<span class="ldr-input-help">Enter the Ollama endpoint URL</span>
</div>
+
+ <!-- LM Studio URL (hidden by default) -->
+ <div class="ldr-form-group ldr-half" id="lmstudio_url_container" style="display: none;">
+ <label for="lmstudio_url">LM Studio Endpoint</label>
+ <input type="text" id="lmstudio_url" name="lmstudio_url" class="ldr-form-control" placeholder="http://localhost:1234" value="{{ settings.llm_lmstudio_url }}">
+ <span class="ldr-input-help">Enter the LM Studio endpoint URL</span>
+ </div>
+
+ <!-- Context Window Size (for local providers, hidden by default) -->
+ <div class="ldr-form-group ldr-half" id="context_window_container" style="display: none;">
+ <label for="context_window">Context Window Size</label>
+ <input type="number" id="context_window" name="context_window" class="ldr-form-control" min="512" max="131072" step="512" value="{{ settings.llm_local_context_window_size }}">
+ <span class="ldr-input-help">Context window size in tokens (num_ctx)</span>
+ </div>
</div>
<div class="ldr-form-row">