~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: honor selected provider and model in news Run Once (#6694)
BingEdward2948ac4ca34d
diff --git a/changelog.d/6584.bugfix.md b/changelog.d/6584.bugfix.mdnew file mode 100644index 0000000000..ef8d74dbcc--- /dev/null+++ b/changelog.d/6584.bugfix.md@@ -0,0 +1 @@+News page Run Once searches now use the selected provider and its native model ID, preserving model-name colons and saved defaults.diff --git a/changelog.d/6694.bugfix.md b/changelog.d/6694.bugfix.mdnew file mode 100644index 0000000000..eb4c1d8742--- /dev/null+++ b/changelog.d/6694.bugfix.md@@ -0,0 +1 @@+Download auto-indexing failures now log a warning without potentially URL-bearing tracebacks.diff --git a/src/local_deep_research/web/static/js/pages/news.js b/src/local_deep_research/web/static/js/pages/news.jsindex eb1644661b..fe35420cc6 100644--- a/src/local_deep_research/web/static/js/pages/news.js+++ b/src/local_deep_research/web/static/js/pages/news.js@@ -317,7 +317,11 @@ function setupEventListeners() {// Use the same advanced search function that the search usesSafeLogger.log('Calling performAdvancedNewsSearch with query:', query);- await performAdvancedNewsSearch(query);+ await performAdvancedNewsSearch(+ query,+ 'source-based',+ getNewsSubscriptionModelConfig(),+ );} else {SafeLogger.error('No query found in news-subscription-query input');showNewsAlert('Please enter a query', 'warning');@@ -577,6 +581,26 @@ function advancedNewsSearchKey(query, strategy, modelConfig) {return JSON.stringify([query, strategy, normalizedModelConfig]);}+function getNewsSubscriptionModelConfig() {+ const model = document.getElementById('news-subscription-model')?.value ?? '';+ if (!model) return null;++ // Match the built-in provider keys; a native model ID can also contain+ // colons (e.g. llama3.1:8b), so a colon alone is not a provider delimiter.+ const knownProviders = new Set([+ 'ANTHROPIC', 'ANTHROPIC_ENDPOINT', 'ATLASCLOUD', 'DEEPSEEK',+ 'GOOGLE', 'IONOS', 'LLAMACPP', 'LMSTUDIO', 'OLLAMA', 'OPENAI',+ 'OPENAI_ENDPOINT', 'OPENROUTER', 'ORCAROUTER', 'REQUESTY', 'XAI',+ ]);+ const separator = model.indexOf(':');+ const provider = model.slice(0, separator).toUpperCase();+ if (separator > 0 && knownProviders.has(provider)) {+ return { provider, model: model.slice(separator + 1) };+ }++ return { provider: '', model };+}+async function performAdvancedNewsSearch(query, strategy = 'source-based', modelConfig = null) {const searchKey = advancedNewsSearchKey(query, strategy, modelConfig);const activeSearch = activeAdvancedNewsSearches.get(searchKey);@@ -4068,7 +4092,11 @@ function showNewsSubscriptionModal(query = '', templateName = '') {// Use the same advanced search function that the search usesSafeLogger.log('Calling performAdvancedNewsSearch with query:', currentQuery);- await performAdvancedNewsSearch(currentQuery);+ await performAdvancedNewsSearch(+ currentQuery,+ 'source-based',+ getNewsSubscriptionModelConfig(),+ );} else {SafeLogger.error('No query found in news-subscription-query input');showNewsAlert('Please enter a query', 'warning');diff --git a/tests/js/pages/news-actions-direct-runtime.test.js b/tests/js/pages/news-actions-direct-runtime.test.jsindex 35e5c473ca..f249f3126a 100644--- a/tests/js/pages/news-actions-direct-runtime.test.js+++ b/tests/js/pages/news-actions-direct-runtime.test.js@@ -1173,12 +1173,40 @@ it('refreshes from the real template button without relying on inline JavaScriptexpect(document.getElementById('news-alert').textContent).toBe('Feed refreshed');});+it.each([+ ['OPENAI:gpt-4.1-mini', 'OPENAI', 'gpt-4.1-mini'],+ ['OLLAMA:llama3.1:8b', 'OLLAMA', 'llama3.1:8b'],+ ['ollama:llama3.1:8b', 'OLLAMA', 'llama3.1:8b'],+ ['llama3.1:8b', undefined, 'llama3.1:8b'],+ ['custom:model:tag', undefined, 'custom:model:tag'],+ ['OLLAMA:OPENAI:model:tag', 'OLLAMA', 'OPENAI:model:tag'],+ ['gpt-4.1-mini', undefined, 'gpt-4.1-mini'],+ ['', undefined, undefined],+])('sends the native model for selection %s', async (selected, provider, model) => {+ const query = `Run Once ${selected}`;+ document.getElementById('news-subscription-query').value = query;+ document.getElementById('news-subscription-model').value = selected;+ document.getElementById('run-template-btn').click();++ await vi.waitFor(() => {+ const request = fetchMock.mock.calls.find(([url, options = {}]) => (+ url === '/api/start_research' && JSON.parse(options.body).query === query+ ));+ expect(request).toBeDefined();+ const payload = JSON.parse(request[1].body);+ expect(payload.model_provider).toBe(provider);+ expect(payload.model).toBe(model);+ });+});+it('runs advanced news and creates its follow-on subscription through migrated contracts', async () => {const query = 'FastAPI follow-on subscriptions';+ const model = 'OPENAI:gpt-4.1-mini';const currentSubscriptionsBefore = fetchMock.mock.calls.filter(([url]) => (url === '/news/api/subscriptions/current')).length;document.getElementById('news-subscription-query').value = query;+ document.getElementById('news-subscription-model').value = model;document.getElementById('run-template-btn').click();@@ -1209,6 +1237,8 @@ it('runs advanced news and creates its follow-on subscription through migrated cdisplay_in: 'news_feed',triggered_by: 'test_run',},+ model_provider: 'OPENAI',+ model: 'gpt-4.1-mini',}),});expect(fetchMock).toHaveBeenCalledWith('/news/api/subscribe', {diff --git a/tests/theme_tests/test_accent_ink_contrast.py b/tests/theme_tests/test_accent_ink_contrast.pyindex bb6ff847f7..6f5c278266 100644--- a/tests/theme_tests/test_accent_ink_contrast.py+++ b/tests/theme_tests/test_accent_ink_contrast.py@@ -1033,12 +1033,12 @@ DYNAMIC_INLINE_STYLES = {),# news.js: ``Math.max(0, Math.min(100, ...))`` and ``Number(...) ||# 10`` are numbers.- ("static/js/pages/news.js", 1209, "width"): (+ ("static/js/pages/news.js", 1233, "width"): ("Math.max(0, Math.min(100, (Number(item.impact_score) || 0) * 10))",(NUMBER,),None,),- ("static/js/pages/news.js", 2870, "width"): (+ ("static/js/pages/news.js", 2894, "width"): ("Number(statusData.progress) || 10",(NUMBER,),None,diff --git a/tests/web/test_js_fetch_parity.py b/tests/web/test_js_fetch_parity.pyindex f6b77133c3..2f73647b95 100644--- a/tests/web/test_js_fetch_parity.py+++ b/tests/web/test_js_fetch_parity.py@@ -990,7 +990,7 @@ LIVE_CASES = (# That is a separate defect (unguarded lookup) and out of scope here;# what matters for *this* test is that 500 means the body passed# validation and the handler ran.- js_ref="pages/news.js:1428",+ js_ref="pages/news.js:1452",method="POST",url=f"/news/api/feedback/{NOPE_UUID}",good={"vote": "up"},diff --git a/tests/web/test_news_run_once_model_dispatch.py b/tests/web/test_news_run_once_model_dispatch.pynew file mode 100644index 0000000000..adead865b4--- /dev/null+++ b/tests/web/test_news_run_once_model_dispatch.py@@ -0,0 +1,109 @@+"""Drive the production news payload through parsing and provider construction."""++import json+from pathlib import Path+import shutil+import subprocess+from unittest.mock import Mock, patch++import pytest+from langchain_core.language_models.fake_chat_models import FakeListChatModel++from local_deep_research.config.llm_config import get_llm+from local_deep_research.llm.providers import discover_providers+from local_deep_research.web.routers.research import _extract_research_params++NEWS_JS = (+ Path(__file__).resolve().parents[2]+ / "src/local_deep_research/web/static/js/pages/news.js"+)+PAYLOAD_PROBE = r"""+const fs = require('node:fs');+const vm = require('node:vm');+const selected = process.argv[2];+let payload;+const context = vm.createContext({+ document: {+ addEventListener() {},+ getElementById() { return { value: selected }; },+ },+ window: {+ api: { getCsrfToken() { return 'test-csrf'; } },+ RESEARCH_STATUS: { QUEUED: 'queued' },+ },+ SafeLogger: { log() {}, error() {} },+ URLS: { API: { START_RESEARCH: '/api/start_research' } },+ fetch: async (url, options) => {+ if (url !== '/api/start_research') throw new Error(url);+ payload = JSON.parse(options.body);+ return { ok: true, json: async () => ({}) };+ },+});+vm.runInContext(fs.readFileSync(process.argv[1], 'utf8'), context);+vm.runInContext('showAlert = () => {}; showNewsAlert = () => {};', context);+vm.runInContext(+ "performAdvancedNewsSearch('news', 'source-based', getNewsSubscriptionModelConfig())",+ context,+).then(() => process.stdout.write(JSON.stringify(payload)));+"""+++ "selected,provider,model",+ [+ ("OPENAI:gpt-4.1-mini", "openai", "gpt-4.1-mini"),+ ("OLLAMA:llama3.1:8b", "ollama", "llama3.1:8b"),+ ("llama3.1:8b", "ollama", "llama3.1:8b"),+ ("custom:model:tag", "ollama", "custom:model:tag"),+ ("ollama:llama3.1:8b", "ollama", "llama3.1:8b"),+ ("OLLAMA:OPENAI:model:tag", "ollama", "OPENAI:model:tag"),+ ("gpt-4.1-mini", "ollama", "gpt-4.1-mini"),+ ("", "ollama", "saved-model:tag"),+ ],+)+def test_news_run_once_model_reaches_provider_constructor(+ selected, provider, model+):+ node = shutil.which("node")+ if node is None:+ pytest.skip(+ "Node.js is required to execute the production news payload"+ )+ result = subprocess.run(+ [node, "-e", PAYLOAD_PROBE, str(NEWS_JS), selected],+ capture_output=True,+ text=True,+ check=True,+ timeout=10,+ )+ payload = json.loads(result.stdout)+ snapshot = {+ "llm.provider": "ollama",+ "llm.model": "saved-model:tag",+ "llm.openai.api_key": "sk-test-key",+ "llm.ollama.url": "http://localhost:11434",+ "llm.supports_max_tokens": True,+ "llm.max_tokens": 4096,+ "rate_limiting.llm_enabled": False,+ "search.tool": "searxng",+ }+ settings = Mock()+ settings.get_setting.side_effect = snapshot.get+ params = _extract_research_params(payload, settings)+ assert params["model_provider"] == provider+ discover_providers(force_refresh=True)+ fake = FakeListChatModel(responses=["unused"])+ target = (+ "local_deep_research.llm.providers.implementations.openai.ChatOpenAI"+ if provider == "openai"+ else "local_deep_research.llm.providers.implementations.ollama.ChatOllama"+ )+ with patch(target, return_value=fake) as constructor:+ llm = get_llm(+ provider=params["model_provider"],+ model_name=params["model"],+ settings_snapshot=snapshot,+ )+ constructor.assert_called_once()+ assert constructor.call_args.kwargs["model"] == model+ assert llm.base_llm is fake