~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
fixed windows and fixed bug in search system
LearningCircuitad7a2e54275f
diff --git a/pyproject.toml b/pyproject.tomlindex 7696330fa9..9544b14221 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"[project]name = "local-deep-research"-version = "0.1.12"+version = "0.1.13"description = "AI-powered research assistant with deep, iterative analysis using LLMs and web searches"readme = "README.md"requires-python = ">=3.8"diff --git a/src/local_deep_research/config.py b/src/local_deep_research/config.pyindex 561cdc13b4..bd4ffe4362 100644--- a/src/local_deep_research/config.py+++ b/src/local_deep_research/config.py@@ -9,11 +9,19 @@ logger = logging.getLogger(__name__)# Get config directorydef get_config_dir():- from platformdirs import user_config_dir- config_dir = Path(user_config_dir("local_deep_research", "LearningCircuit"))+ import platform++ if platform.system() == "Windows":+ # Windows: Use Documents directory+ from platformdirs import user_documents_dir+ config_dir = Path(user_documents_dir()) / "LearningCircuit" / "local-deep-research"+ else:+ # Linux/Mac: Use standard config directory+ from platformdirs import user_config_dir+ config_dir = Path(user_config_dir("local_deep_research", "LearningCircuit"))+print(f"Looking for config in: {config_dir}")return config_dir-# Define config pathsCONFIG_DIR = get_config_dir() / "config"CONFIG_DIR.mkdir(parents=True, exist_ok=True)@@ -98,53 +106,100 @@ def get_search(search_tool=None):def init_config_files():"""Initialize config files if they don't exist"""import shutil- from importlib.resources import files-- # Get default files path- try:- defaults_dir = files('local_deep_research.defaults')- except ImportError:- # Fallback for older Python versions- from pkg_resources import resource_filename- defaults_dir = Path(resource_filename('local_deep_research', 'defaults'))+ import os+ import sys+ import platform- # Create settings.toml if it doesn't exist- settings_file = CONFIG_DIR / "settings.toml"- if not settings_file.exists():- shutil.copy(defaults_dir / "main.toml", settings_file)- logger.info(f"Created settings.toml at {settings_file}")+ # Ensure CONFIG_DIR exists with explicit creation+ os.makedirs(CONFIG_DIR, exist_ok=True)- # Create llm_config.py if it doesn't exist- llm_config_file = CONFIG_DIR / "llm_config.py"- if not llm_config_file.exists():- shutil.copy(defaults_dir / "llm_config.py", llm_config_file)- logger.info(f"Created llm_config.py at {llm_config_file}")+ # Get default files path with more reliable approach for Windows+ if platform.system() == "Windows":+ # Use a more reliable method on Windows+ from pkg_resources import resource_filename+ try:+ defaults_dir = Path(resource_filename('local_deep_research', 'defaults'))+ logger.info(f"Using pkg_resources for Windows: {defaults_dir}")++ # Create settings.toml if it doesn't exist (with explicit Windows paths)+ settings_file = os.path.join(CONFIG_DIR, "settings.toml")+ default_settings = os.path.join(defaults_dir, "main.toml")+ if not os.path.exists(settings_file) and os.path.exists(default_settings):+ shutil.copyfile(default_settings, settings_file)+ logger.info(f"Created settings.toml at {settings_file}")++ # Create llm_config.py if it doesn't exist+ llm_config_file = os.path.join(CONFIG_DIR, "llm_config.py")+ default_llm = os.path.join(defaults_dir, "llm_config.py")+ if not os.path.exists(llm_config_file) and os.path.exists(default_llm):+ shutil.copyfile(default_llm, llm_config_file)+ logger.info(f"Created llm_config.py at {llm_config_file}")++ # Create local_collections.toml if it doesn't exist+ collections_file = os.path.join(CONFIG_DIR, "local_collections.toml")+ default_collections = os.path.join(defaults_dir, "local_collections.toml")+ if not os.path.exists(collections_file) and os.path.exists(default_collections):+ shutil.copyfile(default_collections, collections_file)+ logger.info(f"Created local_collections.toml at {collections_file}")++ # Create search_engines.toml if it doesn't exist+ search_engines_file = os.path.join(CONFIG_DIR, "search_engines.toml")+ default_engines = os.path.join(defaults_dir, "search_engines.toml")+ if not os.path.exists(search_engines_file) and os.path.exists(default_engines):+ shutil.copyfile(default_engines, search_engines_file)+ logger.info(f"Created search_engines.toml at {search_engines_file}")+ except Exception as e:+ logger.error(f"Error initializing Windows config files: {e}")+ else:+ """Initialize config files if they don't exist"""+ import shutil+ from importlib.resources import files- # Create local_collections.toml if it doesn't exist- collections_file = CONFIG_DIR / "local_collections.toml"- if not collections_file.exists():- shutil.copy(defaults_dir / "local_collections.toml", collections_file)- logger.info(f"Created local_collections.toml at {collections_file}")-- # Create search_engines.toml if it doesn't exist- search_engines_file = CONFIG_DIR / "search_engines.toml"- if not search_engines_file.exists():- shutil.copy(defaults_dir / "search_engines.toml", search_engines_file)- logger.info(f"Created search_engines.toml at {search_engines_file}")+ # Get default files path+ try:+ defaults_dir = files('local_deep_research.defaults')+ except ImportError:+ # Fallback for older Python versions+ from pkg_resources import resource_filename+ defaults_dir = Path(resource_filename('local_deep_research', 'defaults'))- secrets_file = CONFIG_DIR / ".secrets.toml"- if not secrets_file.exists():- with open(secrets_file, "w") as f:- f.write("""-# ANTHROPIC_API_KEY = "your-api-key-here"-# OPENAI_API_KEY = "your-openai-key-here"-# GOOGLE_API_KEY = "your-google-key-here"-# SERP_API_KEY = "your-api-key-here"-# GUARDIAN_API_KEY = "your-api-key-here"-# GOOGLE_PSE_API_KEY = "your-google-api-key-here"-# GOOGLE_PSE_ENGINE_ID = "your-programmable-search-engine-id-here"-""")+ # Create settings.toml if it doesn't exist+ settings_file = CONFIG_DIR / "settings.toml"+ if not settings_file.exists():+ shutil.copy(defaults_dir / "main.toml", settings_file)+ logger.info(f"Created settings.toml at {settings_file}")+ # Create llm_config.py if it doesn't exist+ llm_config_file = CONFIG_DIR / "llm_config.py"+ if not llm_config_file.exists():+ shutil.copy(defaults_dir / "llm_config.py", llm_config_file)+ logger.info(f"Created llm_config.py at {llm_config_file}")++ # Create local_collections.toml if it doesn't exist+ collections_file = CONFIG_DIR / "local_collections.toml"+ if not collections_file.exists():+ shutil.copy(defaults_dir / "local_collections.toml", collections_file)+ logger.info(f"Created local_collections.toml at {collections_file}")++ # Create search_engines.toml if it doesn't exist+ search_engines_file = CONFIG_DIR / "search_engines.toml"+ if not search_engines_file.exists():+ shutil.copy(defaults_dir / "search_engines.toml", search_engines_file)+ logger.info(f"Created search_engines.toml at {search_engines_file}")++ secrets_file = CONFIG_DIR / ".secrets.toml"+ if not secrets_file.exists():+ with open(secrets_file, "w") as f:+ f.write("""+ # ANTHROPIC_API_KEY = "your-api-key-here"+ # OPENAI_API_KEY = "your-openai-key-here"+ # GOOGLE_API_KEY = "your-google-key-here"+ # SERP_API_KEY = "your-api-key-here"+ # GUARDIAN_API_KEY = "your-api-key-here"+ # GOOGLE_PSE_API_KEY = "your-google-api-key-here"+ # GOOGLE_PSE_ENGINE_ID = "your-programmable-search-engine-id-here"+ """)+# Initialize config files on importinit_config_files()diff --git a/src/local_deep_research/search_system.py b/src/local_deep_research/search_system.pyindex 0264835fc5..3db386cc2c 100644--- a/src/local_deep_research/search_system.py+++ b/src/local_deep_research/search_system.py@@ -182,7 +182,7 @@ class AdvancedSearchSystem:int(question_progress_base + 2),{"phase": "search_complete", "result_count": len(search_results)})- logger.info("len search", len(search_results))+ logger.info(f"len search: {len(search_results)}")if len(search_results) == 0:continue