local-deep-research 0.1.1__py3-none-any.whl → 0.1.13__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/config.py +100 -45
- local_deep_research/search_system.py +1 -1
- local_deep_research/web/app.py +373 -64
- local_deep_research/web/static/css/styles.css +245 -6
- local_deep_research/web/static/js/app.js +1917 -675
- local_deep_research/web/templates/index.html +34 -0
- {local_deep_research-0.1.1.dist-info → local_deep_research-0.1.13.dist-info}/METADATA +9 -3
- {local_deep_research-0.1.1.dist-info → local_deep_research-0.1.13.dist-info}/RECORD +12 -12
- {local_deep_research-0.1.1.dist-info → local_deep_research-0.1.13.dist-info}/WHEEL +1 -1
- {local_deep_research-0.1.1.dist-info → local_deep_research-0.1.13.dist-info}/entry_points.txt +0 -0
- {local_deep_research-0.1.1.dist-info → local_deep_research-0.1.13.dist-info/licenses}/LICENSE +0 -0
- {local_deep_research-0.1.1.dist-info → local_deep_research-0.1.13.dist-info}/top_level.txt +0 -0
local_deep_research/config.py
CHANGED
@@ -9,11 +9,19 @@ logger = logging.getLogger(__name__)
|
|
9
9
|
|
10
10
|
# Get config directory
|
11
11
|
def get_config_dir():
|
12
|
-
|
13
|
-
|
12
|
+
import platform
|
13
|
+
|
14
|
+
if platform.system() == "Windows":
|
15
|
+
# Windows: Use Documents directory
|
16
|
+
from platformdirs import user_documents_dir
|
17
|
+
config_dir = Path(user_documents_dir()) / "LearningCircuit" / "local-deep-research"
|
18
|
+
else:
|
19
|
+
# Linux/Mac: Use standard config directory
|
20
|
+
from platformdirs import user_config_dir
|
21
|
+
config_dir = Path(user_config_dir("local_deep_research", "LearningCircuit"))
|
22
|
+
|
14
23
|
print(f"Looking for config in: {config_dir}")
|
15
24
|
return config_dir
|
16
|
-
|
17
25
|
# Define config paths
|
18
26
|
CONFIG_DIR = get_config_dir() / "config"
|
19
27
|
CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
@@ -98,53 +106,100 @@ def get_search(search_tool=None):
|
|
98
106
|
def init_config_files():
|
99
107
|
"""Initialize config files if they don't exist"""
|
100
108
|
import shutil
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
try:
|
105
|
-
defaults_dir = files('local_deep_research.defaults')
|
106
|
-
except ImportError:
|
107
|
-
# Fallback for older Python versions
|
108
|
-
from pkg_resources import resource_filename
|
109
|
-
defaults_dir = Path(resource_filename('local_deep_research', 'defaults'))
|
109
|
+
import os
|
110
|
+
import sys
|
111
|
+
import platform
|
110
112
|
|
111
|
-
#
|
112
|
-
|
113
|
-
if not settings_file.exists():
|
114
|
-
shutil.copy(defaults_dir / "main.toml", settings_file)
|
115
|
-
logger.info(f"Created settings.toml at {settings_file}")
|
113
|
+
# Ensure CONFIG_DIR exists with explicit creation
|
114
|
+
os.makedirs(CONFIG_DIR, exist_ok=True)
|
116
115
|
|
117
|
-
#
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
116
|
+
# Get default files path with more reliable approach for Windows
|
117
|
+
if platform.system() == "Windows":
|
118
|
+
# Use a more reliable method on Windows
|
119
|
+
from pkg_resources import resource_filename
|
120
|
+
try:
|
121
|
+
defaults_dir = Path(resource_filename('local_deep_research', 'defaults'))
|
122
|
+
logger.info(f"Using pkg_resources for Windows: {defaults_dir}")
|
123
|
+
|
124
|
+
# Create settings.toml if it doesn't exist (with explicit Windows paths)
|
125
|
+
settings_file = os.path.join(CONFIG_DIR, "settings.toml")
|
126
|
+
default_settings = os.path.join(defaults_dir, "main.toml")
|
127
|
+
if not os.path.exists(settings_file) and os.path.exists(default_settings):
|
128
|
+
shutil.copyfile(default_settings, settings_file)
|
129
|
+
logger.info(f"Created settings.toml at {settings_file}")
|
130
|
+
|
131
|
+
# Create llm_config.py if it doesn't exist
|
132
|
+
llm_config_file = os.path.join(CONFIG_DIR, "llm_config.py")
|
133
|
+
default_llm = os.path.join(defaults_dir, "llm_config.py")
|
134
|
+
if not os.path.exists(llm_config_file) and os.path.exists(default_llm):
|
135
|
+
shutil.copyfile(default_llm, llm_config_file)
|
136
|
+
logger.info(f"Created llm_config.py at {llm_config_file}")
|
137
|
+
|
138
|
+
# Create local_collections.toml if it doesn't exist
|
139
|
+
collections_file = os.path.join(CONFIG_DIR, "local_collections.toml")
|
140
|
+
default_collections = os.path.join(defaults_dir, "local_collections.toml")
|
141
|
+
if not os.path.exists(collections_file) and os.path.exists(default_collections):
|
142
|
+
shutil.copyfile(default_collections, collections_file)
|
143
|
+
logger.info(f"Created local_collections.toml at {collections_file}")
|
144
|
+
|
145
|
+
# Create search_engines.toml if it doesn't exist
|
146
|
+
search_engines_file = os.path.join(CONFIG_DIR, "search_engines.toml")
|
147
|
+
default_engines = os.path.join(defaults_dir, "search_engines.toml")
|
148
|
+
if not os.path.exists(search_engines_file) and os.path.exists(default_engines):
|
149
|
+
shutil.copyfile(default_engines, search_engines_file)
|
150
|
+
logger.info(f"Created search_engines.toml at {search_engines_file}")
|
151
|
+
except Exception as e:
|
152
|
+
logger.error(f"Error initializing Windows config files: {e}")
|
153
|
+
else:
|
154
|
+
"""Initialize config files if they don't exist"""
|
155
|
+
import shutil
|
156
|
+
from importlib.resources import files
|
122
157
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
search_engines_file = CONFIG_DIR / "search_engines.toml"
|
131
|
-
if not search_engines_file.exists():
|
132
|
-
shutil.copy(defaults_dir / "search_engines.toml", search_engines_file)
|
133
|
-
logger.info(f"Created search_engines.toml at {search_engines_file}")
|
158
|
+
# Get default files path
|
159
|
+
try:
|
160
|
+
defaults_dir = files('local_deep_research.defaults')
|
161
|
+
except ImportError:
|
162
|
+
# Fallback for older Python versions
|
163
|
+
from pkg_resources import resource_filename
|
164
|
+
defaults_dir = Path(resource_filename('local_deep_research', 'defaults'))
|
134
165
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
# OPENAI_API_KEY = "your-openai-key-here"
|
141
|
-
# GOOGLE_API_KEY = "your-google-key-here"
|
142
|
-
# SERP_API_KEY = "your-api-key-here"
|
143
|
-
# GUARDIAN_API_KEY = "your-api-key-here"
|
144
|
-
# GOOGLE_PSE_API_KEY = "your-google-api-key-here"
|
145
|
-
# GOOGLE_PSE_ENGINE_ID = "your-programmable-search-engine-id-here"
|
146
|
-
""")
|
166
|
+
# Create settings.toml if it doesn't exist
|
167
|
+
settings_file = CONFIG_DIR / "settings.toml"
|
168
|
+
if not settings_file.exists():
|
169
|
+
shutil.copy(defaults_dir / "main.toml", settings_file)
|
170
|
+
logger.info(f"Created settings.toml at {settings_file}")
|
147
171
|
|
172
|
+
# Create llm_config.py if it doesn't exist
|
173
|
+
llm_config_file = CONFIG_DIR / "llm_config.py"
|
174
|
+
if not llm_config_file.exists():
|
175
|
+
shutil.copy(defaults_dir / "llm_config.py", llm_config_file)
|
176
|
+
logger.info(f"Created llm_config.py at {llm_config_file}")
|
177
|
+
|
178
|
+
# Create local_collections.toml if it doesn't exist
|
179
|
+
collections_file = CONFIG_DIR / "local_collections.toml"
|
180
|
+
if not collections_file.exists():
|
181
|
+
shutil.copy(defaults_dir / "local_collections.toml", collections_file)
|
182
|
+
logger.info(f"Created local_collections.toml at {collections_file}")
|
183
|
+
|
184
|
+
# Create search_engines.toml if it doesn't exist
|
185
|
+
search_engines_file = CONFIG_DIR / "search_engines.toml"
|
186
|
+
if not search_engines_file.exists():
|
187
|
+
shutil.copy(defaults_dir / "search_engines.toml", search_engines_file)
|
188
|
+
logger.info(f"Created search_engines.toml at {search_engines_file}")
|
189
|
+
|
190
|
+
secrets_file = CONFIG_DIR / ".secrets.toml"
|
191
|
+
if not secrets_file.exists():
|
192
|
+
with open(secrets_file, "w") as f:
|
193
|
+
f.write("""
|
194
|
+
# ANTHROPIC_API_KEY = "your-api-key-here"
|
195
|
+
# OPENAI_API_KEY = "your-openai-key-here"
|
196
|
+
# GOOGLE_API_KEY = "your-google-key-here"
|
197
|
+
# SERP_API_KEY = "your-api-key-here"
|
198
|
+
# GUARDIAN_API_KEY = "your-api-key-here"
|
199
|
+
# GOOGLE_PSE_API_KEY = "your-google-api-key-here"
|
200
|
+
# GOOGLE_PSE_ENGINE_ID = "your-programmable-search-engine-id-here"
|
201
|
+
""")
|
202
|
+
|
148
203
|
# Initialize config files on import
|
149
204
|
init_config_files()
|
150
205
|
|
@@ -182,7 +182,7 @@ class AdvancedSearchSystem:
|
|
182
182
|
int(question_progress_base + 2),
|
183
183
|
{"phase": "search_complete", "result_count": len(search_results)})
|
184
184
|
|
185
|
-
logger.info("len search
|
185
|
+
logger.info(f"len search: {len(search_results)}")
|
186
186
|
|
187
187
|
if len(search_results) == 0:
|
188
188
|
continue
|