~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
Partially revert the DB initialization change. (#860)
Daniel Petti88683c7ea7c9
diff --git a/src/local_deep_research/database/encrypted_db.py b/src/local_deep_research/database/encrypted_db.pyindex 8677662f26..13aa599abf 100644--- a/src/local_deep_research/database/encrypted_db.py+++ b/src/local_deep_research/database/encrypted_db.py@@ -194,10 +194,11 @@ class DatabaseManager:conn = sqlcipher3.connect(str(db_path), isolation_level=None, check_same_thread=False)- # Use centralized SQLCipher setup - apply BEFORE setting key+ # Use centralized SQLCipher setup+apply_sqlcipher_pragmas(conn, creation_mode=True)set_sqlcipher_key(conn, password)- apply_performance_pragmas(conn, username)+ apply_sqlcipher_pragmas(conn, creation_mode=True)# Get the CREATE TABLE statements from SQLAlchemy modelsfrom sqlalchemy.dialects import sqlite@@ -243,15 +244,17 @@ class DatabaseManager:)cursor = conn.cursor()- # Use same order as creation: pragmas first, then key- apply_sqlcipher_pragmas(cursor, creation_mode=True)+ # Use centralized SQLCipher setupset_sqlcipher_key(cursor, password)- apply_performance_pragmas(cursor, username)- # Verify connection works AFTER setting everything up+ # Verify connection worksif not verify_sqlcipher_connection(cursor):raise ValueError("Failed to verify database key")+ # Apply SQLCipher and performance settings+ apply_sqlcipher_pragmas(cursor, creation_mode=False)+ apply_performance_pragmas(cursor, username)+cursor.close()return conn@@ -549,12 +552,11 @@ class DatabaseManager:)cursor = conn.cursor()- # Use same settings as creation: pragmas first, then key- apply_sqlcipher_pragmas(cursor, creation_mode=True)+ # Use centralized SQLCipher setupset_sqlcipher_key(cursor, password)- apply_performance_pragmas(cursor, username)+ apply_sqlcipher_pragmas(cursor, creation_mode=False)- # Verify connection works AFTER applying all settings+ # Verify connection worksif not verify_sqlcipher_connection(cursor):raise ValueError("Failed to verify database key")except Exception as e:diff --git a/src/local_deep_research/database/sqlcipher_utils.py b/src/local_deep_research/database/sqlcipher_utils.pyindex 792ae6baf1..2f3717d59b 100644--- a/src/local_deep_research/database/sqlcipher_utils.py+++ b/src/local_deep_research/database/sqlcipher_utils.py@@ -136,11 +136,12 @@ def apply_sqlcipher_pragmas(# Get settings (from database if available, otherwise defaults)settings = get_sqlcipher_settings(username)- # Core settings needed for both creation and access - apply in correct order+ # Core settings needed for both creation and accesscursor_or_conn.execute(f"PRAGMA cipher_page_size = {settings['page_size']}")cursor_or_conn.execute(f"PRAGMA cipher_hmac_algorithm = {settings['hmac_algorithm']}")+cursor_or_conn.execute(f"PRAGMA kdf_iter = {settings['kdf_iterations']}")if creation_mode:@@ -228,15 +229,19 @@ def create_sqlcipher_connection(db_path: str, password: str) -> Any:conn = sqlcipher3.connect(str(db_path))cursor = conn.cursor()- # Apply settings in same order as creation: pragmas first, then key- apply_sqlcipher_pragmas(cursor, creation_mode=True)+ # Set encryption keyset_sqlcipher_key(cursor, password)- apply_performance_pragmas(cursor)- # Verify connection AFTER applying all settings+ # Apply SQLCipher settings+ apply_sqlcipher_pragmas(cursor, creation_mode=False)++ # Verify connectionif not verify_sqlcipher_connection(cursor):conn.close()raise ValueError("Failed to establish encrypted database connection")+ # Apply performance settings+ apply_performance_pragmas(cursor)+cursor.close()return conn