local-deep-research 0.1.25__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- local_deep_research/__init__.py +23 -22
- local_deep_research/__main__.py +16 -0
- local_deep_research/advanced_search_system/__init__.py +7 -0
- local_deep_research/advanced_search_system/filters/__init__.py +8 -0
- local_deep_research/advanced_search_system/filters/base_filter.py +38 -0
- local_deep_research/advanced_search_system/filters/cross_engine_filter.py +200 -0
- local_deep_research/advanced_search_system/findings/base_findings.py +81 -0
- local_deep_research/advanced_search_system/findings/repository.py +452 -0
- local_deep_research/advanced_search_system/knowledge/__init__.py +1 -0
- local_deep_research/advanced_search_system/knowledge/base_knowledge.py +151 -0
- local_deep_research/advanced_search_system/knowledge/standard_knowledge.py +159 -0
- local_deep_research/advanced_search_system/questions/__init__.py +1 -0
- local_deep_research/advanced_search_system/questions/base_question.py +64 -0
- local_deep_research/advanced_search_system/questions/decomposition_question.py +445 -0
- local_deep_research/advanced_search_system/questions/standard_question.py +119 -0
- local_deep_research/advanced_search_system/repositories/__init__.py +7 -0
- local_deep_research/advanced_search_system/strategies/__init__.py +1 -0
- local_deep_research/advanced_search_system/strategies/base_strategy.py +118 -0
- local_deep_research/advanced_search_system/strategies/iterdrag_strategy.py +450 -0
- local_deep_research/advanced_search_system/strategies/parallel_search_strategy.py +312 -0
- local_deep_research/advanced_search_system/strategies/rapid_search_strategy.py +270 -0
- local_deep_research/advanced_search_system/strategies/standard_strategy.py +300 -0
- local_deep_research/advanced_search_system/tools/__init__.py +1 -0
- local_deep_research/advanced_search_system/tools/base_tool.py +100 -0
- local_deep_research/advanced_search_system/tools/knowledge_tools/__init__.py +1 -0
- local_deep_research/advanced_search_system/tools/question_tools/__init__.py +1 -0
- local_deep_research/advanced_search_system/tools/search_tools/__init__.py +1 -0
- local_deep_research/api/__init__.py +5 -5
- local_deep_research/api/research_functions.py +96 -84
- local_deep_research/app.py +8 -0
- local_deep_research/citation_handler.py +25 -16
- local_deep_research/{config.py → config/config_files.py} +113 -120
- local_deep_research/config/llm_config.py +472 -0
- local_deep_research/config/search_config.py +77 -0
- local_deep_research/defaults/.env.template +10 -7
- local_deep_research/defaults/__init__.py +10 -5
- local_deep_research/defaults/main.toml +2 -2
- local_deep_research/defaults/search_engines.toml +60 -34
- local_deep_research/main.py +121 -19
- local_deep_research/migrate_db.py +147 -0
- local_deep_research/report_generator.py +72 -44
- local_deep_research/search_system.py +147 -283
- local_deep_research/setup_data_dir.py +35 -0
- local_deep_research/test_migration.py +178 -0
- local_deep_research/utilities/__init__.py +0 -0
- local_deep_research/utilities/db_utils.py +49 -0
- local_deep_research/{utilties → utilities}/enums.py +2 -2
- local_deep_research/{utilties → utilities}/llm_utils.py +63 -29
- local_deep_research/utilities/search_utilities.py +242 -0
- local_deep_research/{utilties → utilities}/setup_utils.py +4 -2
- local_deep_research/web/__init__.py +0 -1
- local_deep_research/web/app.py +86 -1709
- local_deep_research/web/app_factory.py +289 -0
- local_deep_research/web/database/README.md +70 -0
- local_deep_research/web/database/migrate_to_ldr_db.py +289 -0
- local_deep_research/web/database/migrations.py +447 -0
- local_deep_research/web/database/models.py +117 -0
- local_deep_research/web/database/schema_upgrade.py +107 -0
- local_deep_research/web/models/database.py +294 -0
- local_deep_research/web/models/settings.py +94 -0
- local_deep_research/web/routes/api_routes.py +559 -0
- local_deep_research/web/routes/history_routes.py +354 -0
- local_deep_research/web/routes/research_routes.py +715 -0
- local_deep_research/web/routes/settings_routes.py +1592 -0
- local_deep_research/web/services/research_service.py +947 -0
- local_deep_research/web/services/resource_service.py +149 -0
- local_deep_research/web/services/settings_manager.py +669 -0
- local_deep_research/web/services/settings_service.py +187 -0
- local_deep_research/web/services/socket_service.py +210 -0
- local_deep_research/web/static/css/custom_dropdown.css +277 -0
- local_deep_research/web/static/css/settings.css +1223 -0
- local_deep_research/web/static/css/styles.css +525 -48
- local_deep_research/web/static/js/components/custom_dropdown.js +428 -0
- local_deep_research/web/static/js/components/detail.js +348 -0
- local_deep_research/web/static/js/components/fallback/formatting.js +122 -0
- local_deep_research/web/static/js/components/fallback/ui.js +215 -0
- local_deep_research/web/static/js/components/history.js +487 -0
- local_deep_research/web/static/js/components/logpanel.js +949 -0
- local_deep_research/web/static/js/components/progress.js +1107 -0
- local_deep_research/web/static/js/components/research.js +1865 -0
- local_deep_research/web/static/js/components/results.js +766 -0
- local_deep_research/web/static/js/components/settings.js +3981 -0
- local_deep_research/web/static/js/components/settings_sync.js +106 -0
- local_deep_research/web/static/js/main.js +226 -0
- local_deep_research/web/static/js/services/api.js +253 -0
- local_deep_research/web/static/js/services/audio.js +31 -0
- local_deep_research/web/static/js/services/formatting.js +119 -0
- local_deep_research/web/static/js/services/pdf.js +622 -0
- local_deep_research/web/static/js/services/socket.js +882 -0
- local_deep_research/web/static/js/services/ui.js +546 -0
- local_deep_research/web/templates/base.html +72 -0
- local_deep_research/web/templates/components/custom_dropdown.html +47 -0
- local_deep_research/web/templates/components/log_panel.html +32 -0
- local_deep_research/web/templates/components/mobile_nav.html +22 -0
- local_deep_research/web/templates/components/settings_form.html +299 -0
- local_deep_research/web/templates/components/sidebar.html +21 -0
- local_deep_research/web/templates/pages/details.html +73 -0
- local_deep_research/web/templates/pages/history.html +51 -0
- local_deep_research/web/templates/pages/progress.html +57 -0
- local_deep_research/web/templates/pages/research.html +139 -0
- local_deep_research/web/templates/pages/results.html +59 -0
- local_deep_research/web/templates/settings_dashboard.html +78 -192
- local_deep_research/web/utils/__init__.py +0 -0
- local_deep_research/web/utils/formatters.py +76 -0
- local_deep_research/web_search_engines/engines/full_search.py +18 -16
- local_deep_research/web_search_engines/engines/meta_search_engine.py +182 -131
- local_deep_research/web_search_engines/engines/search_engine_arxiv.py +224 -139
- local_deep_research/web_search_engines/engines/search_engine_brave.py +88 -71
- local_deep_research/web_search_engines/engines/search_engine_ddg.py +48 -39
- local_deep_research/web_search_engines/engines/search_engine_github.py +415 -204
- local_deep_research/web_search_engines/engines/search_engine_google_pse.py +123 -90
- local_deep_research/web_search_engines/engines/search_engine_guardian.py +210 -157
- local_deep_research/web_search_engines/engines/search_engine_local.py +532 -369
- local_deep_research/web_search_engines/engines/search_engine_local_all.py +42 -36
- local_deep_research/web_search_engines/engines/search_engine_pubmed.py +358 -266
- local_deep_research/web_search_engines/engines/search_engine_searxng.py +211 -159
- local_deep_research/web_search_engines/engines/search_engine_semantic_scholar.py +213 -170
- local_deep_research/web_search_engines/engines/search_engine_serpapi.py +84 -68
- local_deep_research/web_search_engines/engines/search_engine_wayback.py +186 -154
- local_deep_research/web_search_engines/engines/search_engine_wikipedia.py +115 -77
- local_deep_research/web_search_engines/search_engine_base.py +174 -99
- local_deep_research/web_search_engines/search_engine_factory.py +192 -102
- local_deep_research/web_search_engines/search_engines_config.py +22 -15
- {local_deep_research-0.1.25.dist-info → local_deep_research-0.2.0.dist-info}/METADATA +175 -101
- local_deep_research-0.2.0.dist-info/RECORD +135 -0
- {local_deep_research-0.1.25.dist-info → local_deep_research-0.2.0.dist-info}/WHEEL +1 -2
- {local_deep_research-0.1.25.dist-info → local_deep_research-0.2.0.dist-info}/entry_points.txt +3 -0
- local_deep_research/defaults/llm_config.py +0 -338
- local_deep_research/utilties/search_utilities.py +0 -114
- local_deep_research/web/static/js/app.js +0 -3763
- local_deep_research/web/templates/api_keys_config.html +0 -82
- local_deep_research/web/templates/collections_config.html +0 -90
- local_deep_research/web/templates/index.html +0 -348
- local_deep_research/web/templates/llm_config.html +0 -120
- local_deep_research/web/templates/main_config.html +0 -89
- local_deep_research/web/templates/search_engines_config.html +0 -154
- local_deep_research/web/templates/settings.html +0 -519
- local_deep_research-0.1.25.dist-info/RECORD +0 -61
- local_deep_research-0.1.25.dist-info/top_level.txt +0 -1
- /local_deep_research/{utilties → config}/__init__.py +0 -0
- {local_deep_research-0.1.25.dist-info → local_deep_research-0.2.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,168 +1,143 @@
|
|
1
|
-
# local_deep_research/config.py
|
2
|
-
from dynaconf import Dynaconf
|
3
|
-
from pathlib import Path
|
4
1
|
import logging
|
5
|
-
from platformdirs import user_documents_dir
|
6
2
|
import os
|
3
|
+
import platform
|
4
|
+
from pathlib import Path
|
5
|
+
|
6
|
+
from dotenv import load_dotenv
|
7
|
+
from dynaconf import Dynaconf
|
8
|
+
from platformdirs import user_documents_dir
|
9
|
+
|
7
10
|
# Setup logging
|
8
11
|
logger = logging.getLogger(__name__)
|
9
|
-
from dotenv import load_dotenv
|
10
|
-
import platform
|
11
12
|
|
12
|
-
|
13
|
+
|
13
14
|
def get_config_dir():
|
14
15
|
|
15
|
-
|
16
16
|
if platform.system() == "Windows":
|
17
17
|
# Windows: Use Documents directory
|
18
18
|
from platformdirs import user_documents_dir
|
19
|
-
|
19
|
+
|
20
|
+
config_dir = (
|
21
|
+
Path(user_documents_dir()) / "LearningCircuit" / "local-deep-research"
|
22
|
+
)
|
20
23
|
else:
|
21
24
|
# Linux/Mac: Use standard config directory
|
22
25
|
from platformdirs import user_config_dir
|
26
|
+
|
23
27
|
config_dir = Path(user_config_dir("local_deep_research", "LearningCircuit"))
|
24
|
-
|
28
|
+
|
25
29
|
logger.info(f"Looking for config in: {config_dir}")
|
26
30
|
return config_dir
|
31
|
+
|
32
|
+
|
27
33
|
# Define config paths
|
28
34
|
CONFIG_DIR = get_config_dir() / "config"
|
29
35
|
CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
30
36
|
SETTINGS_FILE = CONFIG_DIR / "settings.toml"
|
31
37
|
SECRETS_FILE = CONFIG_DIR / ".secrets.toml"
|
32
|
-
LLM_CONFIG_FILE = CONFIG_DIR / "llm_config.py"
|
33
38
|
SEARCH_ENGINES_FILE = CONFIG_DIR / "search_engines.toml"
|
34
39
|
|
35
40
|
LOCAL_COLLECTIONS_FILE = CONFIG_DIR / "local_collections.toml"
|
36
41
|
|
37
|
-
#
|
38
|
-
|
39
|
-
|
40
|
-
|
42
|
+
# Define data directory for database
|
43
|
+
DATA_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "data"))
|
44
|
+
os.makedirs(DATA_DIR, exist_ok=True)
|
45
|
+
DB_PATH = os.path.join(DATA_DIR, "ldr.db")
|
46
|
+
|
47
|
+
env_file = CONFIG_DIR / ".env"
|
41
48
|
|
42
49
|
if env_file.exists():
|
43
50
|
logger.info(f"Loading environment variables from: {env_file}")
|
44
51
|
load_dotenv(dotenv_path=env_file)
|
45
52
|
else:
|
46
|
-
logger.warning(
|
53
|
+
logger.warning(
|
54
|
+
f"Warning: .env file not found at {env_file}. Trying secondary location."
|
55
|
+
)
|
56
|
+
env_file_secondary = get_config_dir() / ".env"
|
57
|
+
if env_file_secondary.exists():
|
58
|
+
get_config_dir() / "config"
|
59
|
+
logger.info(f"Loading environment variables from: {env_file_secondary}")
|
60
|
+
load_dotenv(dotenv_path=env_file_secondary)
|
61
|
+
else:
|
62
|
+
logger.warning(f"Warning: .env file also not found at {env_file_secondary}.")
|
63
|
+
|
64
|
+
|
47
65
|
# Set environment variable for Dynaconf to use
|
48
66
|
docs_base = Path(user_documents_dir()) / "local_deep_research"
|
49
67
|
os.environ["DOCS_DIR"] = str(docs_base)
|
50
68
|
|
51
69
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
# Expose get_llm function
|
59
|
-
def get_llm(*args, **kwargs):
|
60
|
-
"""
|
61
|
-
Helper function to get LLM from llm_config.py
|
62
|
-
"""
|
63
|
-
# Import here to avoid circular imports
|
64
|
-
import importlib.util
|
65
|
-
import sys
|
66
|
-
|
67
|
-
llm_config_path = CONFIG_DIR / "llm_config.py"
|
68
|
-
|
69
|
-
# If llm_config.py exists, use it
|
70
|
-
if llm_config_path.exists():
|
71
|
-
if str(CONFIG_DIR) not in sys.path:
|
72
|
-
sys.path.insert(0, str(CONFIG_DIR))
|
73
|
-
|
74
|
-
spec = importlib.util.spec_from_file_location("llm_config", llm_config_path)
|
75
|
-
llm_config = importlib.util.module_from_spec(spec)
|
76
|
-
spec.loader.exec_module(llm_config)
|
77
|
-
|
78
|
-
if hasattr(llm_config, "get_llm"):
|
79
|
-
return llm_config.get_llm(*args, **kwargs)
|
80
|
-
|
81
|
-
# Fallback to utility function
|
82
|
-
from .utilties.llm_utils import get_model
|
83
|
-
return get_model(*args, **kwargs)
|
84
|
-
|
85
|
-
# Expose get_search function
|
86
|
-
def get_search(search_tool=None):
|
87
|
-
"""
|
88
|
-
Helper function to get search engine
|
89
|
-
"""
|
90
|
-
|
91
|
-
# Use specified tool or default from settings
|
92
|
-
tool = search_tool or settings.search.tool
|
93
|
-
logger.info(f"Search tool is: {tool}")
|
94
|
-
|
95
|
-
# Import here to avoid circular imports
|
96
|
-
from .web_search_engines.search_engine_factory import get_search as factory_get_search
|
97
|
-
|
98
|
-
# Get search parameters
|
99
|
-
params = {
|
100
|
-
"search_tool": tool,
|
101
|
-
"llm_instance": get_llm(),
|
102
|
-
"max_results": settings.search.max_results,
|
103
|
-
"region": settings.search.region,
|
104
|
-
"time_period": settings.search.time_period,
|
105
|
-
"safe_search": settings.search.safe_search,
|
106
|
-
"search_snippets_only": settings.search.snippets_only,
|
107
|
-
"search_language": settings.search.search_language,
|
108
|
-
"max_filtered_results": settings.search.max_filtered_results
|
109
|
-
}
|
110
|
-
logger.info(f"Search config params: {params}")
|
111
|
-
# Create and return search engine
|
112
|
-
return factory_get_search(**params)
|
113
|
-
|
114
70
|
def init_config_files():
|
115
71
|
"""Initialize config files if they don't exist"""
|
116
|
-
import shutil
|
117
72
|
import os
|
118
|
-
import sys
|
119
73
|
import platform
|
120
|
-
|
74
|
+
import shutil
|
75
|
+
|
121
76
|
# Ensure CONFIG_DIR exists with explicit creation
|
122
77
|
os.makedirs(CONFIG_DIR, exist_ok=True)
|
123
|
-
|
78
|
+
|
124
79
|
# Get default files path with more reliable approach for Windows
|
125
80
|
if platform.system() == "Windows":
|
126
81
|
# Use a more reliable method on Windows
|
127
82
|
from pkg_resources import resource_filename
|
83
|
+
|
128
84
|
try:
|
129
|
-
defaults_dir = Path(resource_filename(
|
85
|
+
defaults_dir = Path(resource_filename("local_deep_research", "defaults"))
|
130
86
|
logger.info(f"Using pkg_resources for Windows: {defaults_dir}")
|
131
|
-
|
87
|
+
|
132
88
|
# Create settings.toml if it doesn't exist (with explicit Windows paths)
|
133
89
|
settings_file = os.path.join(CONFIG_DIR, "settings.toml")
|
134
90
|
default_settings = os.path.join(defaults_dir, "main.toml")
|
135
91
|
if not os.path.exists(settings_file) and os.path.exists(default_settings):
|
136
92
|
shutil.copyfile(default_settings, settings_file)
|
137
93
|
logger.info(f"Created settings.toml at {settings_file}")
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
94
|
+
# Add note about database-first settings
|
95
|
+
with open(settings_file, "a") as f:
|
96
|
+
f.write(
|
97
|
+
"\n\n# NOTE: Settings in this file are used as fallback only.\n"
|
98
|
+
)
|
99
|
+
f.write(
|
100
|
+
"# Settings stored in the database (ldr.db) take precedence.\n"
|
101
|
+
)
|
102
|
+
f.write(
|
103
|
+
"# To modify settings permanently, use the web interface settings page.\n"
|
104
|
+
)
|
105
|
+
|
146
106
|
# Create local_collections.toml if it doesn't exist
|
147
107
|
collections_file = os.path.join(CONFIG_DIR, "local_collections.toml")
|
148
108
|
default_collections = os.path.join(defaults_dir, "local_collections.toml")
|
149
|
-
if not os.path.exists(collections_file) and os.path.exists(
|
109
|
+
if not os.path.exists(collections_file) and os.path.exists(
|
110
|
+
default_collections
|
111
|
+
):
|
150
112
|
shutil.copyfile(default_collections, collections_file)
|
151
113
|
logger.info(f"Created local_collections.toml at {collections_file}")
|
152
|
-
|
114
|
+
|
153
115
|
# Create search_engines.toml if it doesn't exist
|
154
116
|
search_engines_file = os.path.join(CONFIG_DIR, "search_engines.toml")
|
155
117
|
default_engines = os.path.join(defaults_dir, "search_engines.toml")
|
156
|
-
if not os.path.exists(search_engines_file) and os.path.exists(
|
118
|
+
if not os.path.exists(search_engines_file) and os.path.exists(
|
119
|
+
default_engines
|
120
|
+
):
|
157
121
|
shutil.copyfile(default_engines, search_engines_file)
|
158
122
|
logger.info(f"Created search_engines.toml at {search_engines_file}")
|
159
|
-
|
160
|
-
|
123
|
+
# Add note about database-first settings
|
124
|
+
with open(search_engines_file, "a") as f:
|
125
|
+
f.write(
|
126
|
+
"\n\n# NOTE: Settings in this file are used as fallback only.\n"
|
127
|
+
)
|
128
|
+
f.write(
|
129
|
+
"# Settings stored in the database (ldr.db) take precedence.\n"
|
130
|
+
)
|
131
|
+
f.write(
|
132
|
+
"# To modify search settings permanently, use the web interface settings page.\n"
|
133
|
+
)
|
134
|
+
|
135
|
+
# Create .env.template if it doesn't exist
|
161
136
|
env_template_file = CONFIG_DIR / ".env.template"
|
162
137
|
if not env_template_file.exists():
|
163
138
|
shutil.copy(defaults_dir / ".env.template", env_template_file)
|
164
139
|
logger.info(f"Created .env.template at {env_template_file}")
|
165
|
-
|
140
|
+
|
166
141
|
# Optionally create an empty .env file if it doesn't exist
|
167
142
|
env_file = CONFIG_DIR / ".env"
|
168
143
|
if not env_file.exists():
|
@@ -175,53 +150,68 @@ def init_config_files():
|
|
175
150
|
"""Initialize config files if they don't exist"""
|
176
151
|
import shutil
|
177
152
|
from importlib.resources import files
|
178
|
-
|
153
|
+
|
179
154
|
# Get default files path
|
180
155
|
try:
|
181
|
-
defaults_dir = files(
|
156
|
+
defaults_dir = files("local_deep_research.defaults")
|
182
157
|
except ImportError:
|
183
158
|
# Fallback for older Python versions
|
184
159
|
from pkg_resources import resource_filename
|
185
|
-
|
186
|
-
|
160
|
+
|
161
|
+
defaults_dir = Path(resource_filename("local_deep_research", "defaults"))
|
162
|
+
|
187
163
|
# Create settings.toml if it doesn't exist
|
188
164
|
settings_file = CONFIG_DIR / "settings.toml"
|
189
165
|
if not settings_file.exists():
|
190
166
|
shutil.copy(defaults_dir / "main.toml", settings_file)
|
191
167
|
logger.info(f"Created settings.toml at {settings_file}")
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
168
|
+
# Add note about database-first settings
|
169
|
+
with open(settings_file, "a") as f:
|
170
|
+
f.write(
|
171
|
+
"\n\n# NOTE: Settings in this file are used as fallback only.\n"
|
172
|
+
)
|
173
|
+
f.write("# Settings stored in the database (ldr.db) take precedence.\n")
|
174
|
+
f.write(
|
175
|
+
"# To modify settings permanently, use the web interface settings page.\n"
|
176
|
+
)
|
177
|
+
|
199
178
|
# Create local_collections.toml if it doesn't exist
|
200
179
|
collections_file = CONFIG_DIR / "local_collections.toml"
|
201
180
|
if not collections_file.exists():
|
202
181
|
shutil.copy(defaults_dir / "local_collections.toml", collections_file)
|
203
182
|
logger.info(f"Created local_collections.toml at {collections_file}")
|
204
|
-
|
183
|
+
|
205
184
|
# Create search_engines.toml if it doesn't exist
|
206
185
|
search_engines_file = CONFIG_DIR / "search_engines.toml"
|
207
186
|
if not search_engines_file.exists():
|
208
187
|
shutil.copy(defaults_dir / "search_engines.toml", search_engines_file)
|
209
188
|
logger.info(f"Created search_engines.toml at {search_engines_file}")
|
189
|
+
# Add note about database-first settings
|
190
|
+
with open(search_engines_file, "a") as f:
|
191
|
+
f.write(
|
192
|
+
"\n\n# NOTE: Settings in this file are used as fallback only.\n"
|
193
|
+
)
|
194
|
+
f.write("# Settings stored in the database (ldr.db) take precedence.\n")
|
195
|
+
f.write(
|
196
|
+
"# To modify search settings permanently, use the web interface settings page.\n"
|
197
|
+
)
|
198
|
+
|
210
199
|
env_template_file = CONFIG_DIR / ".env.template"
|
211
200
|
if not env_template_file.exists():
|
212
201
|
shutil.copy(defaults_dir / ".env.template", env_template_file)
|
213
202
|
logger.info(f"Created .env.template at {env_template_file}")
|
214
|
-
|
203
|
+
|
215
204
|
# Optionally create an empty .env file if it doesn't exist
|
216
205
|
env_file = CONFIG_DIR / ".env"
|
217
206
|
if not env_file.exists():
|
218
207
|
with open(env_file, "w") as f:
|
219
208
|
f.write("# Add your environment variables here\n")
|
220
|
-
logger.info(f"Created empty .env file at {env_file}")
|
209
|
+
logger.info(f"Created empty .env file at {env_file}")
|
221
210
|
secrets_file = CONFIG_DIR / ".secrets.toml"
|
222
211
|
if not secrets_file.exists():
|
223
212
|
with open(secrets_file, "w") as f:
|
224
|
-
f.write(
|
213
|
+
f.write(
|
214
|
+
"""
|
225
215
|
# ANTHROPIC_API_KEY = "your-api-key-here"
|
226
216
|
# OPENAI_API_KEY = "your-openai-key-here"
|
227
217
|
# GOOGLE_API_KEY = "your-google-key-here"
|
@@ -229,19 +219,20 @@ def init_config_files():
|
|
229
219
|
# GUARDIAN_API_KEY = "your-api-key-here"
|
230
220
|
# GOOGLE_PSE_API_KEY = "your-google-api-key-here"
|
231
221
|
# GOOGLE_PSE_ENGINE_ID = "your-programmable-search-engine-id-here"
|
232
|
-
"""
|
233
|
-
|
234
|
-
# Initialize config files on import
|
235
|
-
init_config_files()
|
222
|
+
"""
|
223
|
+
)
|
236
224
|
|
237
|
-
|
238
|
-
|
225
|
+
|
226
|
+
# Add a comment to explain the DB-first settings approach
|
227
|
+
logger.info(
|
228
|
+
"Using database-first settings approach. TOML files are used as fallback only."
|
229
|
+
)
|
239
230
|
|
240
231
|
settings = Dynaconf(
|
241
232
|
settings_files=[
|
242
233
|
str(SETTINGS_FILE),
|
243
234
|
str(LOCAL_COLLECTIONS_FILE),
|
244
|
-
str(SEARCH_ENGINES_FILE),
|
235
|
+
str(SEARCH_ENGINES_FILE),
|
245
236
|
],
|
246
237
|
secrets=str(SECRETS_FILE),
|
247
238
|
env_prefix="LDR",
|
@@ -250,3 +241,5 @@ settings = Dynaconf(
|
|
250
241
|
env_file=str(CONFIG_DIR / ".env"),
|
251
242
|
)
|
252
243
|
|
244
|
+
# Initialize config files on import
|
245
|
+
init_config_files()
|