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: Use settings_snapshot instead of direct environment variable access

LearningCircuit0e85b65e7cd1
diff --git a/src/local_deep_research/web_search_engines/engines/search_engine_paperless.py b/src/local_deep_research/web_search_engines/engines/search_engine_paperless.py
index 441c4247a6..6b0a14a68a 100644
--- a/src/local_deep_research/web_search_engines/engines/search_engine_paperless.py
+++ b/src/local_deep_research/web_search_engines/engines/search_engine_paperless.py
@@ -6,7 +6,6 @@ instance, allowing LDR to search and retrieve documents from your personal
document management system.
"""
-import os
import re
from typing import Any, Dict, List, Optional
import requests
@@ -63,24 +62,34 @@ class PaperlessSearchEngine(BaseSearchEngine):
**kwargs,
)
- # Use provided configuration
+ # Use provided configuration or get from settings
self.api_url = api_url
# Support both api_key and api_token for compatibility
self.api_token = api_key or api_token
+ # If no API URL provided, try to get from settings_snapshot
+ if not self.api_url and settings_snapshot:
+ self.api_url = settings_snapshot.get(
+ "search.engine.web.paperless.default_params.api_url",
+ "http://localhost:8000",
+ )
+
+ # If no API token provided, try to get from settings_snapshot
+ if not self.api_token and settings_snapshot:
+ self.api_token = settings_snapshot.get(
+ "search.engine.web.paperless.api_key", ""
+ )
+
# Fix AttributeError: Check if api_url is None before calling rstrip
if self.api_url:
# Remove trailing slash from API URL
self.api_url = self.api_url.rstrip("/")
else:
- # Try environment variable fallback
- self.api_url = os.environ.get("PAPERLESS_API_URL")
- if self.api_url:
- self.api_url = self.api_url.rstrip("/")
- else:
- raise ValueError(
- "Paperless-ngx API URL must be provided via argument or PAPERLESS_API_URL environment variable."
- )
+ # Default to localhost if nothing provided
+ self.api_url = "http://localhost:8000"
+ logger.warning(
+ "No Paperless API URL provided, using default: http://localhost:8000"
+ )
self.timeout = timeout
self.verify_ssl = verify_ssl