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: Address multiple PR review comments from djpetti

LearningCircuit0527f1d41fba
diff --git a/src/local_deep_research/news/flask_api.py b/src/local_deep_research/news/flask_api.py
index 4e41ab678e..c33d817894 100644
--- a/src/local_deep_research/news/flask_api.py
+++ b/src/local_deep_research/news/flask_api.py
@@ -419,7 +419,7 @@ def run_subscription_now(subscription_id: str) -> Dict[str, Any]:
query = subscription["query"]
# Update any date placeholders with current date
- current_date = datetime.now().strftime("%Y-%m-%d")
+ current_date = datetime.now().date().isoformat()
# Replace YYYY-MM-DD placeholder ONLY (not all dates)
query = query.replace("YYYY-MM-DD", current_date)
@@ -957,7 +957,7 @@ def check_overdue_subscriptions():
)
# Update any date placeholders with current date
- current_date = datetime.now().strftime("%Y-%m-%d")
+ current_date = datetime.now().date().isoformat()
query = sub.query_or_topic.replace(
"YYYY-MM-DD", current_date
)
diff --git a/src/local_deep_research/news/subscription_manager/scheduler.py b/src/local_deep_research/news/subscription_manager/scheduler.py
index 78a77cc526..e8f1fd2c09 100644
--- a/src/local_deep_research/news/subscription_manager/scheduler.py
+++ b/src/local_deep_research/news/subscription_manager/scheduler.py
@@ -447,7 +447,7 @@ class NewsScheduler:
query = sub.query_or_topic
if "YYYY-MM-DD" in query:
query = query.replace(
- "YYYY-MM-DD", datetime.now().strftime("%Y-%m-%d")
+ "YYYY-MM-DD", datetime.now().date().isoformat()
)
# Update last/next refresh times
@@ -780,9 +780,9 @@ class NewsScheduler:
title = generated_headline
else:
if subscription_name:
- title = f"{subscription_name} - {datetime.now().strftime('%Y-%m-%d %H:%M')}"
+ title = f"{subscription_name} - {datetime.now().isoformat(timespec='minutes')}"
else:
- title = f"{query_text[:60]}... - {datetime.now().strftime('%Y-%m-%d %H:%M')}"
+ title = f"{query_text[:60]}... - {datetime.now().isoformat(timespec='minutes')}"
# Create research history entry
history_entry = ResearchHistory(
diff --git a/src/local_deep_research/news/subscription_manager/search_subscription.py b/src/local_deep_research/news/subscription_manager/search_subscription.py
index df4cbed281..d8999e84bf 100644
--- a/src/local_deep_research/news/subscription_manager/search_subscription.py
+++ b/src/local_deep_research/news/subscription_manager/search_subscription.py
@@ -85,7 +85,7 @@ class SearchSubscription(BaseSubscription):
str: The transformed search query
"""
# Update any date placeholders with current date
- current_date = datetime.now().strftime("%Y-%m-%d")
+ current_date = datetime.now().date().isoformat()
updated_query = self.current_query
# Replace YYYY-MM-DD placeholder ONLY (not all dates)
diff --git a/src/local_deep_research/news/subscription_manager/topic_subscription.py b/src/local_deep_research/news/subscription_manager/topic_subscription.py
index 30cb17bdf8..eadf457c03 100644
--- a/src/local_deep_research/news/subscription_manager/topic_subscription.py
+++ b/src/local_deep_research/news/subscription_manager/topic_subscription.py
@@ -98,7 +98,7 @@ class TopicSubscription(BaseSubscription):
news_query = f"{base_query} latest news today developments breaking"
# Update any date placeholders with current date
- current_date = datetime.now().strftime("%Y-%m-%d")
+ current_date = datetime.now().date().isoformat()
# Replace YYYY-MM-DD placeholder ONLY (not all dates)
news_query = news_query.replace("YYYY-MM-DD", current_date)
diff --git a/src/local_deep_research/news/utils/topic_generator.py b/src/local_deep_research/news/utils/topic_generator.py
index f5bf7fe61b..1c50638dde 100644
--- a/src/local_deep_research/news/utils/topic_generator.py
+++ b/src/local_deep_research/news/utils/topic_generator.py
@@ -152,7 +152,7 @@ def _extract_fallback_topics(
"nato": "NATO",
"un": "United Nations",
"eu": "European Union",
- "who": "WHO",
+ # Removed "who": "WHO" - too many false positives as djpetti noted
}
# Combine query and findings for analysis
@@ -201,7 +201,8 @@ def _validate_topics(topics: List[str], max_topics: int) -> List[str]:
continue
seen.add(normalized)
- valid_topics.append(cleaned)
+ # Convert to lowercase as djpetti suggested
+ valid_topics.append(normalized)
if len(valid_topics) >= max_topics:
break
diff --git a/src/local_deep_research/news/web.py b/src/local_deep_research/news/web.py
index c359fc80b8..2cd3a2944b 100644
--- a/src/local_deep_research/news/web.py
+++ b/src/local_deep_research/news/web.py
@@ -79,39 +79,8 @@ def create_news_blueprint():
# Only try to get settings if user is logged in
if username != "anonymous":
- try:
- from ..utilities.db_utils import get_setting_from_db_main_thread
-
- # Update default settings with user's actual settings
- # Using the same method as the root page for consistency
- default_settings.update(
- {
- "iterations": get_setting_from_db_main_thread(
- "search.iterations", 3
- ),
- "questions_per_iteration": get_setting_from_db_main_thread(
- "search.questions_per_iteration", 5
- ),
- "search_engine": get_setting_from_db_main_thread(
- "search.tool", "auto"
- ),
- "model_provider": get_setting_from_db_main_thread(
- "llm.provider", "OLLAMA"
- ),
- "model": get_setting_from_db_main_thread(
- "llm.model", ""
- ),
- "search_strategy": get_setting_from_db_main_thread(
- "search.search_strategy", "source-based"
- ),
- "custom_endpoint": get_setting_from_db_main_thread(
- "llm.openai_endpoint.url", ""
- ),
- }
- )
- except Exception as e:
- logger.warning(f"Could not load user settings: {e}")
- # Use defaults
+ # Load user settings using the extracted function
+ load_user_settings(default_settings)
return render_template(
"pages/news-subscription-form.html",
@@ -157,40 +126,8 @@ def create_news_blueprint():
# Load user's default settings if logged in
if username != "anonymous":
- try:
- from ..utilities.db_utils import (
- get_setting_from_db_main_thread,
- )
-
- # Update default settings with user's actual settings
- # Using the same method as the root page for consistency
- default_settings.update(
- {
- "iterations": get_setting_from_db_main_thread(
- "search.iterations", 3
- ),
- "questions_per_iteration": get_setting_from_db_main_thread(
- "search.questions_per_iteration", 5
- ),
- "search_engine": get_setting_from_db_main_thread(
- "search.tool", "auto"
- ),
- "model_provider": get_setting_from_db_main_thread(
- "llm.provider", "OLLAMA"
- ),
- "model": get_setting_from_db_main_thread(
- "llm.model", ""
- ),
- "search_strategy": get_setting_from_db_main_thread(
- "search.search_strategy", "source-based"
- ),
- "custom_endpoint": get_setting_from_db_main_thread(
- "llm.openai_endpoint.url", ""
- ),
- }
- )
- except Exception as e:
- logger.warning(f"Could not load user settings: {e}")
+ # Load user settings using the extracted function
+ load_user_settings(default_settings)
except Exception as e:
logger.exception(
@@ -230,7 +167,46 @@ def create_news_blueprint():
}
)
except Exception as e:
- logger.exception(f"Health check failed: {e}")
+ logger.exception("Health check failed")
return jsonify({"status": "unhealthy", "error": str(e)}), 500
return bp
+
+
+def load_user_settings(default_settings):
+ """
+ Load user settings and update default_settings dictionary.
+ Extracted to avoid code duplication as suggested by djpetti.
+
+ Args:
+ default_settings: Dictionary to update with user settings
+ """
+ try:
+ from ..utilities.db_utils import get_setting_from_db_main_thread
+
+ default_settings.update(
+ {
+ "iterations": get_setting_from_db_main_thread(
+ "search.iterations", 3
+ ),
+ "questions_per_iteration": get_setting_from_db_main_thread(
+ "search.questions_per_iteration", 5
+ ),
+ "search_engine": get_setting_from_db_main_thread(
+ "search.tool", "auto"
+ ),
+ "model_provider": get_setting_from_db_main_thread(
+ "llm.provider", "OLLAMA"
+ ),
+ "model": get_setting_from_db_main_thread("llm.model", ""),
+ "search_strategy": get_setting_from_db_main_thread(
+ "search.search_strategy", "source-based"
+ ),
+ "custom_endpoint": get_setting_from_db_main_thread(
+ "llm.openai_endpoint.url", ""
+ ),
+ }
+ )
+ except Exception as e:
+ logger.warning(f"Could not load user settings: {e}")
+ # Use defaults