deepresearch-flow 0.5.1__py3-none-any.whl → 0.6.1__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.
- deepresearch_flow/paper/cli.py +63 -0
- deepresearch_flow/paper/config.py +87 -12
- deepresearch_flow/paper/db.py +1154 -35
- deepresearch_flow/paper/db_ops.py +124 -19
- deepresearch_flow/paper/extract.py +1546 -152
- deepresearch_flow/paper/prompt_templates/deep_read_phi_system.j2 +2 -0
- deepresearch_flow/paper/prompt_templates/deep_read_phi_user.j2 +5 -0
- deepresearch_flow/paper/prompt_templates/deep_read_system.j2 +2 -0
- deepresearch_flow/paper/prompt_templates/deep_read_user.j2 +272 -40
- deepresearch_flow/paper/prompt_templates/eight_questions_phi_system.j2 +1 -0
- deepresearch_flow/paper/prompt_templates/eight_questions_phi_user.j2 +2 -0
- deepresearch_flow/paper/prompt_templates/eight_questions_system.j2 +2 -0
- deepresearch_flow/paper/prompt_templates/eight_questions_user.j2 +4 -0
- deepresearch_flow/paper/prompt_templates/simple_phi_system.j2 +2 -0
- deepresearch_flow/paper/prompt_templates/simple_system.j2 +2 -0
- deepresearch_flow/paper/prompt_templates/simple_user.j2 +2 -0
- deepresearch_flow/paper/providers/azure_openai.py +45 -3
- deepresearch_flow/paper/providers/openai_compatible.py +45 -3
- deepresearch_flow/paper/schemas/deep_read_phi_schema.json +1 -0
- deepresearch_flow/paper/schemas/deep_read_schema.json +1 -0
- deepresearch_flow/paper/schemas/default_paper_schema.json +6 -0
- deepresearch_flow/paper/schemas/eight_questions_schema.json +1 -0
- deepresearch_flow/paper/snapshot/__init__.py +4 -0
- deepresearch_flow/paper/snapshot/api.py +941 -0
- deepresearch_flow/paper/snapshot/builder.py +965 -0
- deepresearch_flow/paper/snapshot/identity.py +239 -0
- deepresearch_flow/paper/snapshot/schema.py +245 -0
- deepresearch_flow/paper/snapshot/tests/__init__.py +2 -0
- deepresearch_flow/paper/snapshot/tests/test_identity.py +123 -0
- deepresearch_flow/paper/snapshot/text.py +154 -0
- deepresearch_flow/paper/template_registry.py +1 -0
- deepresearch_flow/paper/templates/deep_read.md.j2 +4 -0
- deepresearch_flow/paper/templates/deep_read_phi.md.j2 +4 -0
- deepresearch_flow/paper/templates/default_paper.md.j2 +4 -0
- deepresearch_flow/paper/templates/eight_questions.md.j2 +4 -0
- deepresearch_flow/paper/web/app.py +10 -3
- deepresearch_flow/recognize/cli.py +380 -103
- deepresearch_flow/recognize/markdown.py +31 -7
- deepresearch_flow/recognize/math.py +47 -12
- deepresearch_flow/recognize/mermaid.py +320 -10
- deepresearch_flow/recognize/organize.py +29 -7
- deepresearch_flow/translator/cli.py +71 -20
- deepresearch_flow/translator/engine.py +220 -81
- deepresearch_flow/translator/prompts.py +19 -2
- deepresearch_flow/translator/protector.py +15 -3
- deepresearch_flow-0.6.1.dist-info/METADATA +849 -0
- {deepresearch_flow-0.5.1.dist-info → deepresearch_flow-0.6.1.dist-info}/RECORD +51 -43
- {deepresearch_flow-0.5.1.dist-info → deepresearch_flow-0.6.1.dist-info}/WHEEL +1 -1
- deepresearch_flow-0.5.1.dist-info/METADATA +0 -440
- {deepresearch_flow-0.5.1.dist-info → deepresearch_flow-0.6.1.dist-info}/entry_points.txt +0 -0
- {deepresearch_flow-0.5.1.dist-info → deepresearch_flow-0.6.1.dist-info}/licenses/LICENSE +0 -0
- {deepresearch_flow-0.5.1.dist-info → deepresearch_flow-0.6.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,849 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deepresearch-flow
|
|
3
|
+
Version: 0.6.1
|
|
4
|
+
Summary: Workflow tools for paper extraction, review, and research automation.
|
|
5
|
+
Author-email: DengQi <dengqi935@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 DengQi
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/nerdneilsfield/ai-deepresearch-flow
|
|
29
|
+
Project-URL: Repository, https://github.com/nerdneilsfield/ai-deepresearch-flow
|
|
30
|
+
Project-URL: Issues, https://github.com/nerdneilsfield/ai-deepresearch-flow/issues
|
|
31
|
+
Keywords: research,papers,pdf,ocr,llm,workflow
|
|
32
|
+
Classifier: Development Status :: 3 - Alpha
|
|
33
|
+
Classifier: Intended Audience :: Science/Research
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
|
36
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
37
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
38
|
+
Requires-Python: >=3.12
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
License-File: LICENSE
|
|
41
|
+
Requires-Dist: anthropic>=0.77.0
|
|
42
|
+
Requires-Dist: click>=8.1.7
|
|
43
|
+
Requires-Dist: coloredlogs>=15.0.1
|
|
44
|
+
Requires-Dist: dashscope>=1.25.10
|
|
45
|
+
Requires-Dist: google-auth>=2.48.0
|
|
46
|
+
Requires-Dist: google-genai>=1.60.0
|
|
47
|
+
Requires-Dist: httpx>=0.27.0
|
|
48
|
+
Requires-Dist: jinja2>=3.1.3
|
|
49
|
+
Requires-Dist: json-repair>=0.55.1
|
|
50
|
+
Requires-Dist: jsonschema>=4.26.0
|
|
51
|
+
Requires-Dist: markdown-it-py>=3.0.0
|
|
52
|
+
Requires-Dist: mdit-py-plugins>=0.4.0
|
|
53
|
+
Requires-Dist: pypdf>=6.6.2
|
|
54
|
+
Requires-Dist: pylatexenc>=2.10
|
|
55
|
+
Requires-Dist: pybtex>=0.24.0
|
|
56
|
+
Requires-Dist: rich>=14.3.1
|
|
57
|
+
Requires-Dist: rumdl>=0.1.6
|
|
58
|
+
Requires-Dist: starlette>=0.52.1
|
|
59
|
+
Requires-Dist: tqdm>=4.66.4
|
|
60
|
+
Requires-Dist: uvicorn>=0.27.1
|
|
61
|
+
Dynamic: license-file
|
|
62
|
+
|
|
63
|
+
<p align="center">
|
|
64
|
+
<img src=".github/assets/logo.png" width="140" alt="ai-deepresearch-flow logo" />
|
|
65
|
+
</p>
|
|
66
|
+
|
|
67
|
+
<h3 align="center">ai-deepresearch-flow</h3>
|
|
68
|
+
|
|
69
|
+
<p align="center">
|
|
70
|
+
<em>From documents to deep research insight — automatically.</em>
|
|
71
|
+
</p>
|
|
72
|
+
|
|
73
|
+
<p align="center">
|
|
74
|
+
<a href="README.md">English</a> | <a href="README_ZH.md">中文</a>
|
|
75
|
+
</p>
|
|
76
|
+
|
|
77
|
+
<p align="center">
|
|
78
|
+
<a href="https://github.com/nerdneilsfield/ai-deepresearch-flow/actions">
|
|
79
|
+
<img src="https://img.shields.io/github/actions/workflow/status/nerdneilsfield/ai-deepresearch-flow/push-to-pypi.yml?style=flat-square" />
|
|
80
|
+
</a>
|
|
81
|
+
<a href="https://pypi.org/project/deepresearch-flow/">
|
|
82
|
+
<img src="https://img.shields.io/pypi/v/deepresearch-flow?style=flat-square" />
|
|
83
|
+
</a>
|
|
84
|
+
<a href="https://pypi.org/project/deepresearch-flow/">
|
|
85
|
+
<img src="https://img.shields.io/pypi/pyversions/deepresearch-flow?style=flat-square" />
|
|
86
|
+
</a>
|
|
87
|
+
<a href="https://hub.docker.com/r/nerdneils/deepresearch-flow">
|
|
88
|
+
<img src="https://img.shields.io/docker/v/nerdneils/deepresearch-flow?style=flat-square" />
|
|
89
|
+
</a>
|
|
90
|
+
<a href="https://github.com/nerdneilsfield/ai-deepresearch-flow/pkgs/container/deepresearch-flow">
|
|
91
|
+
<img src="https://img.shields.io/badge/ghcr.io-nerdneilsfield%2Fdeepresearch-flow-0f172a?style=flat-square" />
|
|
92
|
+
</a>
|
|
93
|
+
<a href="https://github.com/nerdneilsfield/ai-deepresearch-flow/blob/main/LICENSE">
|
|
94
|
+
<img src="https://img.shields.io/github/license/nerdneilsfield/ai-deepresearch-flow?style=flat-square" />
|
|
95
|
+
</a>
|
|
96
|
+
<a href="https://github.com/nerdneilsfield/ai-deepresearch-flow/stargazers">
|
|
97
|
+
<img src="https://img.shields.io/github/stars/nerdneilsfield/ai-deepresearch-flow?style=flat-square" />
|
|
98
|
+
</a>
|
|
99
|
+
<a href="https://pypi.org/project/deepresearch-flow">
|
|
100
|
+
<img alt="PyPI - Version" src="https://img.shields.io/pypi/v/deepresearch-flow">
|
|
101
|
+
</a>
|
|
102
|
+
<a href="https://github.com/nerdneilsfield/ai-deepresearch-flow/issues">
|
|
103
|
+
<img src="https://img.shields.io/github/issues/nerdneilsfield/ai-deepresearch-flow?style=flat-square" />
|
|
104
|
+
</a>
|
|
105
|
+
</p>
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## The Core Pain Points
|
|
110
|
+
|
|
111
|
+
- **OCR Chaos**: Raw markdown from OCR tools is often broken -- tables drift, formulas break, and references are non-clickable.
|
|
112
|
+
- **Translation Nightmares**: Translating technical papers often destroys code blocks, LaTeX formulas, and table structures.
|
|
113
|
+
- **Information Overload**: Extracting structured insights (authors, venues, summaries) from hundreds of PDFs manually is impossible.
|
|
114
|
+
- **Context Switching**: Managing PDFs, summaries, and translations in different windows kills focus.
|
|
115
|
+
|
|
116
|
+
## The Solution
|
|
117
|
+
|
|
118
|
+
DeepResearch Flow provides a unified pipeline to **Repair**, **Translate**, **Extract**, and **Serve** your research library.
|
|
119
|
+
|
|
120
|
+
## Key Features
|
|
121
|
+
|
|
122
|
+
- **Smart Extraction**: Turn unstructured Markdown into schema-enforced JSON (summaries, metadata, Q&A) using LLMs (OpenAI, Claude, Gemini, etc.).
|
|
123
|
+
- **Precision Translation**: Translate OCR Markdown to Chinese/Japanese (`.zh.md`, `.ja.md`) while **freezing** formulas, code, tables, and references. No more broken layout.
|
|
124
|
+
- **Local Knowledge DB**: A high-performance local Web UI to browse papers with **Split View** (Source vs. Translated vs. Summary), full-text search, and multi-dimensional filtering.
|
|
125
|
+
- **Snapshot + API Serve**: Build a production-ready SQLite snapshot with static assets, then serve a read-only JSON API for a separate frontend.
|
|
126
|
+
- **Coverage Compare**: Compare JSON/PDF/Markdown/Translated datasets to find missing artifacts and export CSV reports.
|
|
127
|
+
- **Matched Export**: Extract matched JSON or translated Markdown after coverage checks.
|
|
128
|
+
- **OCR Post-Processing**: Automatically fix broken references (`[1]` -> `[^1]`), merge split paragraphs, and standardize layouts.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Quick Start
|
|
133
|
+
|
|
134
|
+
### 1) Installation
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Recommended: using uv for speed
|
|
138
|
+
uv pip install deepresearch-flow
|
|
139
|
+
|
|
140
|
+
# Or standard pip
|
|
141
|
+
pip install deepresearch-flow
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 2) Configuration
|
|
145
|
+
|
|
146
|
+
Set up your LLM providers. We support OpenAI, Claude, Gemini, Ollama, and more.
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
cp config.example.toml config.toml
|
|
150
|
+
# Edit config.toml to add your API keys (e.g., env:OPENAI_API_KEY)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Multiple keys per provider are supported. Keys rotate per request and enter a short cooldown on retryable errors.
|
|
154
|
+
You can also provide quota metadata per key:
|
|
155
|
+
|
|
156
|
+
```toml
|
|
157
|
+
api_keys = [
|
|
158
|
+
"env:OPENAI_API_KEY",
|
|
159
|
+
{ key = "env:OPENAI_API_KEY_2", quota_duration = 18000, reset_time = "2026-01-23 18:04:25 +0800 CST", quota_error_tokens = ["exceed", "quota"] }
|
|
160
|
+
]
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### 3) The "Zero to Hero" Workflow
|
|
164
|
+
|
|
165
|
+
#### Step 1: Extract Insights
|
|
166
|
+
|
|
167
|
+
Scan a folder of markdown files and extract structured summaries.
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
uv run deepresearch-flow paper extract \
|
|
171
|
+
--input ./docs \
|
|
172
|
+
--model openai/gpt-4o-mini \
|
|
173
|
+
--prompt-template deep_read
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
<p align="center">
|
|
177
|
+
<img src=".github/assets/extract.png" width="70%" alt="extract" />
|
|
178
|
+
</p>
|
|
179
|
+
|
|
180
|
+
#### Step 1.1: Verify & Retry Missing Fields
|
|
181
|
+
|
|
182
|
+
Validate extracted JSON against the template schema and retry only the missing items.
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
uv run deepresearch-flow paper db verify \
|
|
186
|
+
--input-json ./paper_infos.json \
|
|
187
|
+
--prompt-template deep_read \
|
|
188
|
+
--output-json ./paper_verify.json
|
|
189
|
+
|
|
190
|
+
uv run deepresearch-flow paper extract \
|
|
191
|
+
--input ./docs \
|
|
192
|
+
--model openai/gpt-4o-mini \
|
|
193
|
+
--prompt-template deep_read \
|
|
194
|
+
--retry-list-json ./paper_verify.json
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
<p align="center">
|
|
198
|
+
<img src=".github/assets/verify.png" width="70%" alt="verify" />
|
|
199
|
+
</p>
|
|
200
|
+
|
|
201
|
+
#### Step 2: Translate Safely
|
|
202
|
+
|
|
203
|
+
Translate papers to Chinese, protecting LaTeX and tables.
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
uv run deepresearch-flow translator translate \
|
|
207
|
+
--input ./docs \
|
|
208
|
+
--target-lang zh \
|
|
209
|
+
--model openai/gpt-4o-mini \
|
|
210
|
+
--fix-level moderate
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
#### Step 3: Repair OCR Outputs (Recommended)
|
|
214
|
+
|
|
215
|
+
Recommended sequence to stabilize markdown before serving:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# 1) Fix OCR markdown (auto-detects JSON if inputs are .json)
|
|
219
|
+
uv run deepresearch-flow recognize fix \
|
|
220
|
+
--input ./docs \
|
|
221
|
+
--in-place
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
<p align="center">
|
|
225
|
+
<img src=".github/assets/fix.png" width="70%" alt="fix" />
|
|
226
|
+
</p>
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# 2) Fix LaTeX formulas
|
|
230
|
+
uv run deepresearch-flow recognize fix-math \
|
|
231
|
+
--input ./docs \
|
|
232
|
+
--model openai/gpt-4o-mini \
|
|
233
|
+
--in-place
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
<p align="center">
|
|
237
|
+
<img src=".github/assets/fix-math.png" width="70%" alt="fix math" />
|
|
238
|
+
</p>
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
# 3) Fix Mermaid diagrams
|
|
242
|
+
uv run deepresearch-flow recognize fix-mermaid \
|
|
243
|
+
--input ./paper_outputs \
|
|
244
|
+
--json \
|
|
245
|
+
--model openai/gpt-4o-mini \
|
|
246
|
+
--in-place
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
<p align="center">
|
|
250
|
+
<img src=".github/assets/fix-mermaid.png" width="70%" alt="fix mermaid" />
|
|
251
|
+
</p>
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
# (optional) Retry failed formulas/diagrams only
|
|
255
|
+
uv run deepresearch-flow recognize fix-math \
|
|
256
|
+
--input ./docs \
|
|
257
|
+
--model openai/gpt-4o-mini \
|
|
258
|
+
--retry-failed
|
|
259
|
+
|
|
260
|
+
uv run deepresearch-flow recognize fix-mermaid \
|
|
261
|
+
--input ./paper_outputs \
|
|
262
|
+
--json \
|
|
263
|
+
--model openai/gpt-4o-mini \
|
|
264
|
+
--retry-failed
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
<p align="center">
|
|
268
|
+
<img src=".github/assets/fix-retry-failed.png" width="70%" alt="fix retry failed" />
|
|
269
|
+
</p>
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
# 4) Fix again to normalize formatting
|
|
273
|
+
uv run deepresearch-flow recognize fix \
|
|
274
|
+
--input ./docs \
|
|
275
|
+
--in-place
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
#### Step 4: Serve Your Database
|
|
279
|
+
|
|
280
|
+
Launch a local UI to read and manage your papers.
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
uv run deepresearch-flow paper db serve \
|
|
284
|
+
--input paper_infos.json \
|
|
285
|
+
--md-root ./docs \
|
|
286
|
+
--md-translated-root ./docs \
|
|
287
|
+
--host 127.0.0.1
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
#### Step 4.5: Build Snapshot + Serve API + Frontend (Recommended)
|
|
291
|
+
|
|
292
|
+
Build a production snapshot (SQLite + static assets), serve a read-only API, and run the frontend.
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
# 1) Build snapshot + static export
|
|
296
|
+
uv run deepresearch-flow paper db snapshot build \
|
|
297
|
+
--input ./paper_infos.json \
|
|
298
|
+
--bibtex ./papers.bib \
|
|
299
|
+
--md-root ./docs \
|
|
300
|
+
--md-translated-root ./docs \
|
|
301
|
+
--pdf-root ./pdfs \
|
|
302
|
+
--output-db ./dist/paper_snapshot.db \
|
|
303
|
+
--static-export-dir ./dist/paper-static
|
|
304
|
+
|
|
305
|
+
# 2) Serve static assets (CORS required for ZIP export)
|
|
306
|
+
npx http-server ./dist/paper-static -p 8002 --cors
|
|
307
|
+
|
|
308
|
+
# 3) Serve API (read-only)
|
|
309
|
+
PAPER_DB_STATIC_BASE_URL=http://127.0.0.1:8002 \
|
|
310
|
+
uv run deepresearch-flow paper db api serve \
|
|
311
|
+
--snapshot-db ./dist/paper_snapshot.db \
|
|
312
|
+
--cors-origin http://127.0.0.1:5173 \
|
|
313
|
+
--host 127.0.0.1 --port 8001
|
|
314
|
+
|
|
315
|
+
# 4) Run frontend
|
|
316
|
+
cd frontend
|
|
317
|
+
npm install
|
|
318
|
+
VITE_PAPER_DB_API_BASE=http://127.0.0.1:8001/api/v1 \
|
|
319
|
+
VITE_PAPER_DB_STATIC_BASE=http://127.0.0.1:8002 \
|
|
320
|
+
npm run dev
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Incremental PDF Library Workflow
|
|
326
|
+
|
|
327
|
+
This workflow keeps a growing PDF library in sync without reprocessing everything.
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
# 1) Compare processed JSON vs new PDF library to find missing PDFs
|
|
331
|
+
uv run deepresearch-flow paper db compare \
|
|
332
|
+
--input-a ./paper_infos.json \
|
|
333
|
+
--pdf-root-b ./pdfs_new \
|
|
334
|
+
--output-only-in-b ./pdfs_todo.txt
|
|
335
|
+
|
|
336
|
+
# 2) Stage the missing PDFs for OCR
|
|
337
|
+
uv run deepresearch-flow paper db transfer-pdfs \
|
|
338
|
+
--input-list ./pdfs_todo.txt \
|
|
339
|
+
--output-dir ./pdfs_todo \
|
|
340
|
+
--copy
|
|
341
|
+
|
|
342
|
+
# (optional) use --move instead of --copy
|
|
343
|
+
# uv run deepresearch-flow paper db transfer-pdfs --input-list ./pdfs_todo.txt --output-dir ./pdfs_todo --move
|
|
344
|
+
|
|
345
|
+
# 3) OCR the missing PDFs (use your OCR tool; write markdowns to ./md_todo)
|
|
346
|
+
|
|
347
|
+
# 4) Export matched existing assets against the new PDF library
|
|
348
|
+
uv run deepresearch-flow paper db extract \
|
|
349
|
+
--input-json ./paper_infos.json \
|
|
350
|
+
--pdf-root ./pdfs_new \
|
|
351
|
+
--output-json ./paper_infos_matched.json
|
|
352
|
+
|
|
353
|
+
uv run deepresearch-flow paper db extract \
|
|
354
|
+
--md-source-root ./mds \
|
|
355
|
+
--output-md-root ./mds_matched \
|
|
356
|
+
--pdf-root ./pdfs_new
|
|
357
|
+
|
|
358
|
+
uv run deepresearch-flow paper db extract \
|
|
359
|
+
--md-translated-root ./translated \
|
|
360
|
+
--output-md-translated-root ./translated_matched \
|
|
361
|
+
--pdf-root ./pdfs_new \
|
|
362
|
+
--lang zh
|
|
363
|
+
|
|
364
|
+
# 5) Translate + extract summaries for the new OCR markdowns
|
|
365
|
+
uv run deepresearch-flow translator translate \
|
|
366
|
+
--input ./md_todo \
|
|
367
|
+
--target-lang zh \
|
|
368
|
+
--model openai/gpt-4o-mini
|
|
369
|
+
|
|
370
|
+
uv run deepresearch-flow paper extract \
|
|
371
|
+
--input ./md_todo \
|
|
372
|
+
--model openai/gpt-4o-mini
|
|
373
|
+
|
|
374
|
+
# 6) Merge and serve the new library (multi-input)
|
|
375
|
+
uv run deepresearch-flow paper db serve \
|
|
376
|
+
--input ./paper_infos_matched.json \
|
|
377
|
+
--input ./paper_infos_new.json \
|
|
378
|
+
--md-root ./mds_matched \
|
|
379
|
+
--md-root ./md_todo \
|
|
380
|
+
--md-translated-root ./translated_matched \
|
|
381
|
+
--md-translated-root ./md_todo \
|
|
382
|
+
--pdf-root ./pdfs_new
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
## Merge Paper JSONs
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
# Merge multiple libraries using the same template
|
|
389
|
+
uv run deepresearch-flow paper db merge library \
|
|
390
|
+
--inputs ./paper_infos_a.json \
|
|
391
|
+
--inputs ./paper_infos_b.json \
|
|
392
|
+
--output ./paper_infos_merged.json
|
|
393
|
+
|
|
394
|
+
# Merge multiple templates from the same library (first input wins on shared fields)
|
|
395
|
+
uv run deepresearch-flow paper db merge templates \
|
|
396
|
+
--inputs ./simple.json \
|
|
397
|
+
--inputs ./deep_read.json \
|
|
398
|
+
--output ./paper_infos_templates.json
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
Note: `paper db merge` is now split into `merge library` and `merge templates`.
|
|
402
|
+
|
|
403
|
+
### Merge multiple databases (PDF + Markdown + BibTeX)
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
# 1) Copy PDFs into a single folder
|
|
407
|
+
rsync -av ./pdfs_a/ ./pdfs_merged/
|
|
408
|
+
rsync -av ./pdfs_b/ ./pdfs_merged/
|
|
409
|
+
|
|
410
|
+
# 2) Copy Markdown folders into a single folder
|
|
411
|
+
rsync -av ./md_a/ ./md_merged/
|
|
412
|
+
rsync -av ./md_b/ ./md_merged/
|
|
413
|
+
|
|
414
|
+
# 3) Merge JSON libraries
|
|
415
|
+
uv run deepresearch-flow paper db merge library \
|
|
416
|
+
--inputs ./paper_infos_a.json \
|
|
417
|
+
--inputs ./paper_infos_b.json \
|
|
418
|
+
--output ./paper_infos_merged.json
|
|
419
|
+
|
|
420
|
+
# 4) Merge BibTeX files
|
|
421
|
+
uv run deepresearch-flow paper db merge bibtex \
|
|
422
|
+
-i ./library_a.bib \
|
|
423
|
+
-i ./library_b.bib \
|
|
424
|
+
-o ./library_merged.bib
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Merge BibTeX files
|
|
428
|
+
|
|
429
|
+
```bash
|
|
430
|
+
uv run deepresearch-flow paper db merge bibtex \
|
|
431
|
+
-i ./library_a.bib \
|
|
432
|
+
-i ./library_b.bib \
|
|
433
|
+
-o ./library_merged.bib
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
Duplicate keys keep the entry with the most fields; ties keep the first input order.
|
|
437
|
+
|
|
438
|
+
### Recommended: Merge templates then filter by BibTeX
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
# 1) Merge templates for the same library
|
|
442
|
+
uv run deepresearch-flow paper db merge templates \
|
|
443
|
+
--inputs ./deep_read.json \
|
|
444
|
+
--inputs ./simple.json \
|
|
445
|
+
--output ./all.json
|
|
446
|
+
|
|
447
|
+
# 2) Filter the merged set with BibTeX
|
|
448
|
+
uv run deepresearch-flow paper db extract \
|
|
449
|
+
--input-bibtex ./library.bib \
|
|
450
|
+
--json ./all.json \
|
|
451
|
+
--output-json ./library_filtered.json \
|
|
452
|
+
--output-csv ./library_filtered.csv
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
## Deployment (Static CDN)
|
|
456
|
+
|
|
457
|
+
The recommended production setup is **front/back separation**:
|
|
458
|
+
|
|
459
|
+
- **Static CDN** hosts PDFs/Markdown/images/summaries.
|
|
460
|
+
- **API server** serves a read-only snapshot DB.
|
|
461
|
+
- **Frontend** is a separate static app (Vite build or any static host).
|
|
462
|
+
|
|
463
|
+
<p align="center">
|
|
464
|
+
<img src=".github/assets/frontend.png" width="80%" alt="frontend" />
|
|
465
|
+
</p>
|
|
466
|
+
|
|
467
|
+
### 1) Build snapshot + static export
|
|
468
|
+
|
|
469
|
+
```bash
|
|
470
|
+
uv run deepresearch-flow paper db snapshot build \
|
|
471
|
+
--input ./paper_infos.json \
|
|
472
|
+
--bibtex ./papers.bib \
|
|
473
|
+
--md-root ./docs \
|
|
474
|
+
--md-translated-root ./docs \
|
|
475
|
+
--pdf-root ./pdfs \
|
|
476
|
+
--output-db ./dist/paper_snapshot.db \
|
|
477
|
+
--static-export-dir /data/paper-static
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
Notes:
|
|
481
|
+
- The build host must be able to read the original PDF/Markdown roots.
|
|
482
|
+
- The CDN only needs the exported directory (e.g. `/data/paper-static`).
|
|
483
|
+
|
|
484
|
+
### 2) Serve static assets with CORS + cache headers (Caddy example)
|
|
485
|
+
|
|
486
|
+
```caddyfile
|
|
487
|
+
:8002 {
|
|
488
|
+
root * /data/paper-static
|
|
489
|
+
encode zstd gzip
|
|
490
|
+
|
|
491
|
+
@static path /pdf/* /md/* /md_translate/* /images/*
|
|
492
|
+
header @static {
|
|
493
|
+
Access-Control-Allow-Origin *
|
|
494
|
+
Access-Control-Allow-Methods GET,HEAD,OPTIONS
|
|
495
|
+
Access-Control-Allow-Headers *
|
|
496
|
+
Cache-Control "public, max-age=31536000, immutable"
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
@options method OPTIONS
|
|
500
|
+
respond @options 204
|
|
501
|
+
|
|
502
|
+
file_server
|
|
503
|
+
}
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### 2.1) Nginx example (API + frontend on one domain, static on another)
|
|
507
|
+
|
|
508
|
+
```nginx
|
|
509
|
+
# Frontend + API (same domain)
|
|
510
|
+
server {
|
|
511
|
+
listen 80;
|
|
512
|
+
server_name frontend.example.com;
|
|
513
|
+
|
|
514
|
+
root /var/www/paper-frontend;
|
|
515
|
+
index index.html;
|
|
516
|
+
|
|
517
|
+
location / {
|
|
518
|
+
try_files $uri /index.html;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
location /api/ {
|
|
522
|
+
proxy_pass http://127.0.0.1:8001/;
|
|
523
|
+
proxy_set_header Host $host;
|
|
524
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
525
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
# Static assets (separate domain)
|
|
530
|
+
server {
|
|
531
|
+
listen 80;
|
|
532
|
+
server_name static.example.com;
|
|
533
|
+
|
|
534
|
+
root /data/paper-static;
|
|
535
|
+
|
|
536
|
+
location / {
|
|
537
|
+
add_header Access-Control-Allow-Origin *;
|
|
538
|
+
add_header Access-Control-Allow-Methods "GET,HEAD,OPTIONS";
|
|
539
|
+
add_header Access-Control-Allow-Headers "*";
|
|
540
|
+
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
541
|
+
try_files $uri =404;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
### 3) Start the API server (read-only)
|
|
547
|
+
|
|
548
|
+
```bash
|
|
549
|
+
export PAPER_DB_STATIC_BASE_URL="https://static.example.com"
|
|
550
|
+
|
|
551
|
+
uv run deepresearch-flow paper db api serve \
|
|
552
|
+
--snapshot-db /data/paper_snapshot.db \
|
|
553
|
+
--cors-origin https://frontend.example.com \
|
|
554
|
+
--host 0.0.0.0 --port 8001
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
### 4) Frontend (static build or dev)
|
|
558
|
+
|
|
559
|
+
```bash
|
|
560
|
+
cd frontend
|
|
561
|
+
npm install
|
|
562
|
+
|
|
563
|
+
# Dev
|
|
564
|
+
VITE_PAPER_DB_API_BASE=https://api.example.com/api/v1 \
|
|
565
|
+
VITE_PAPER_DB_STATIC_BASE=https://static.example.com \
|
|
566
|
+
npm run dev
|
|
567
|
+
|
|
568
|
+
# Build for static hosting
|
|
569
|
+
VITE_PAPER_DB_API_BASE=https://api.example.com/api/v1 \
|
|
570
|
+
VITE_PAPER_DB_STATIC_BASE=https://static.example.com \
|
|
571
|
+
npm run build
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
## Comprehensive Guide
|
|
577
|
+
|
|
578
|
+
<details>
|
|
579
|
+
<summary><strong>1. Translator: OCR-Safe Translation</strong></summary>
|
|
580
|
+
|
|
581
|
+
The translator module is built for scientific documents. It uses a node-based architecture to ensure stability.
|
|
582
|
+
|
|
583
|
+
- Structure Protection: automatically detects and "freezes" code blocks, LaTeX (`$$...$$`), HTML tables, and images before sending text to the LLM.
|
|
584
|
+
- OCR Repair: use `--fix-level` to merge broken paragraphs and convert text references (`[1]`) to clickable Markdown footnotes (`[^1]`).
|
|
585
|
+
- Context-Aware: supports retries for failed chunks and falls back gracefully.
|
|
586
|
+
- Group Concurrency: use `--group-concurrency` to run multiple translation groups in parallel per document.
|
|
587
|
+
|
|
588
|
+
```bash
|
|
589
|
+
# Translate with structure protection and OCR repairs
|
|
590
|
+
uv run deepresearch-flow translator translate \
|
|
591
|
+
--input ./paper.md \
|
|
592
|
+
--target-lang ja \
|
|
593
|
+
--fix-level aggressive \
|
|
594
|
+
--group-concurrency 4 \
|
|
595
|
+
--model claude/claude-3-5-sonnet-20240620
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
</details>
|
|
599
|
+
|
|
600
|
+
<details>
|
|
601
|
+
<summary><strong>2. Paper Extract: Structured Knowledge</strong></summary>
|
|
602
|
+
|
|
603
|
+
Turn loose markdown files into a queryable database.
|
|
604
|
+
|
|
605
|
+
- Templates: built-in prompts like `simple`, `eight_questions`, and `deep_read` guide the LLM to extract specific insights.
|
|
606
|
+
- Async and throttled: precise control over concurrency (`--max-concurrency`), rate limits (`--sleep-every`), and request timeout (`--timeout`).
|
|
607
|
+
- Incremental: skips already processed files; resumes from where you left off.
|
|
608
|
+
- Stage resume: multi-stage templates persist per-module outputs; use `--force-stage <name>` to rerun a module.
|
|
609
|
+
- Stage DAG: enable `--stage-dag` (or `extract.stage_dag = true`) for dependency-aware parallelism; DAG mode only passes dependency outputs to a stage and `--dry-run` prints the per-stage plan.
|
|
610
|
+
- Diagram hints: `deep_read` can emit inferred diagrams labeled `[Inferred]`; use `recognize fix-mermaid` on rendered markdown if needed.
|
|
611
|
+
- Stage focus: multi-stage runs emphasize the active module and summarize others to reduce context overload.
|
|
612
|
+
- Range filter: use `--start-idx/--end-idx` to slice inputs; range applies before `--retry-failed`/`--retry-failed-stages` (`--end-idx -1` = last item).
|
|
613
|
+
- Retry failed stages: use `--retry-failed-stages` to re-run only failed stages (multi-stage templates); missing stages are forced to run. Retry runs keep existing results and only update retried items.
|
|
614
|
+
|
|
615
|
+
```bash
|
|
616
|
+
uv run deepresearch-flow paper extract \
|
|
617
|
+
--input ./library \
|
|
618
|
+
--output paper_data.json \
|
|
619
|
+
--template-dir ./my-custom-prompts \
|
|
620
|
+
--max-concurrency 10 \
|
|
621
|
+
--timeout 180
|
|
622
|
+
|
|
623
|
+
# Extract items 0..99, then retry only failed ones from that range
|
|
624
|
+
uv run deepresearch-flow paper extract \
|
|
625
|
+
--input ./library \
|
|
626
|
+
--start-idx 0 \
|
|
627
|
+
--end-idx 100 \
|
|
628
|
+
--retry-failed \
|
|
629
|
+
--model claude/claude-3-5-sonnet-20240620
|
|
630
|
+
|
|
631
|
+
# Retry only failed stages in multi-stage templates
|
|
632
|
+
uv run deepresearch-flow paper extract \
|
|
633
|
+
--input ./library \
|
|
634
|
+
--retry-failed-stages \
|
|
635
|
+
--model claude/claude-3-5-sonnet-20240620
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
</details>
|
|
639
|
+
|
|
640
|
+
<details>
|
|
641
|
+
<summary><strong>4. Recognize Fix: Repair Math and Mermaid</strong></summary>
|
|
642
|
+
|
|
643
|
+
Fix broken LaTeX formulas and Mermaid diagrams in markdown or JSON outputs.
|
|
644
|
+
|
|
645
|
+
- Retry Failed: use `--retry-failed` with the prior `--report` output to reprocess only failed formulas/diagrams.
|
|
646
|
+
|
|
647
|
+
```bash
|
|
648
|
+
uv run deepresearch-flow recognize fix-math \
|
|
649
|
+
--input ./docs \
|
|
650
|
+
--in-place \
|
|
651
|
+
--model claude/claude-3-5-sonnet-20240620 \
|
|
652
|
+
--report ./fix-math-errors.json \
|
|
653
|
+
--retry-failed
|
|
654
|
+
|
|
655
|
+
uv run deepresearch-flow recognize fix-mermaid \
|
|
656
|
+
--input ./docs \
|
|
657
|
+
--in-place \
|
|
658
|
+
--model claude/claude-3-5-sonnet-20240620 \
|
|
659
|
+
--report ./fix-mermaid-errors.json \
|
|
660
|
+
--retry-failed
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
</details>
|
|
664
|
+
|
|
665
|
+
<details>
|
|
666
|
+
<summary><strong>3. Database and UI: Your Personal ArXiv</strong></summary>
|
|
667
|
+
|
|
668
|
+
The db serve command creates a local research station.
|
|
669
|
+
|
|
670
|
+
- Split View: read the original PDF/Markdown on the left and the Summary/Translation on the right.
|
|
671
|
+
- Full Text Search: search by title, author, year, or content tags (`tag:fpga year:2023..2024`).
|
|
672
|
+
- Stats: visualize publication trends and keyword frequencies.
|
|
673
|
+
- PDF Viewer: built-in PDF.js viewer prevents cross-origin issues with local files.
|
|
674
|
+
|
|
675
|
+
```bash
|
|
676
|
+
uv run deepresearch-flow paper db serve \
|
|
677
|
+
--input paper_infos.json \
|
|
678
|
+
--pdf-root ./pdfs \
|
|
679
|
+
--cache-dir .cache/db
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
</details>
|
|
683
|
+
|
|
684
|
+
<details>
|
|
685
|
+
<summary><strong>4. Paper DB Compare: Coverage Audit</strong></summary>
|
|
686
|
+
|
|
687
|
+
Compare two datasets (A/B) to find missing PDFs, markdowns, translations, or JSON items, with match metadata.
|
|
688
|
+
|
|
689
|
+
```bash
|
|
690
|
+
uv run deepresearch-flow paper db compare \
|
|
691
|
+
--input-a ./a.json \
|
|
692
|
+
--md-root-b ./md_root \
|
|
693
|
+
--output-csv ./compare.csv
|
|
694
|
+
|
|
695
|
+
# Compare translated markdowns by language
|
|
696
|
+
uv run deepresearch-flow paper db compare \
|
|
697
|
+
--md-translated-root-a ./translated_a \
|
|
698
|
+
--md-translated-root-b ./translated_b \
|
|
699
|
+
--lang zh
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
</details>
|
|
703
|
+
|
|
704
|
+
<details>
|
|
705
|
+
<summary><strong>5. Paper DB Extract: Matched Export</strong></summary>
|
|
706
|
+
|
|
707
|
+
Extract matched JSON entries or translated Markdown after coverage comparison.
|
|
708
|
+
|
|
709
|
+
```bash
|
|
710
|
+
uv run deepresearch-flow paper db extract \
|
|
711
|
+
--json ./processed.json \
|
|
712
|
+
--input-bibtex ./refs.bib \
|
|
713
|
+
--pdf-root ./pdfs \
|
|
714
|
+
--output-json ./matched.json \
|
|
715
|
+
--output-csv ./extract.csv
|
|
716
|
+
|
|
717
|
+
# Use a JSON reference list to filter the target JSON
|
|
718
|
+
uv run deepresearch-flow paper db extract \
|
|
719
|
+
--json ./processed.json \
|
|
720
|
+
--input-json ./reference.json \
|
|
721
|
+
--pdf-root ./pdfs \
|
|
722
|
+
--output-json ./matched.json \
|
|
723
|
+
--output-csv ./extract.csv
|
|
724
|
+
|
|
725
|
+
# Extract translated markdowns by language
|
|
726
|
+
uv run deepresearch-flow paper db extract \
|
|
727
|
+
--md-root ./md_root \
|
|
728
|
+
--md-translated-root ./translated \
|
|
729
|
+
--lang zh \
|
|
730
|
+
--output-md-translated-root ./translated_matched \
|
|
731
|
+
--output-csv ./extract.csv
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
</details>
|
|
735
|
+
|
|
736
|
+
<details>
|
|
737
|
+
<summary><strong>6. Recognize: OCR Post-Processing</strong></summary>
|
|
738
|
+
|
|
739
|
+
Tools to clean up raw outputs from OCR engines like MinerU.
|
|
740
|
+
|
|
741
|
+
- Embed Images: convert local image links to Base64 for a portable single-file Markdown.
|
|
742
|
+
- Unpack Images: extract Base64 images back to files.
|
|
743
|
+
- Organize: flatten nested OCR output directories.
|
|
744
|
+
- Fix: apply OCR fixes and rumdl formatting during organize, or as a standalone step.
|
|
745
|
+
- Fix JSON: apply the same fixes to markdown fields inside paper JSON outputs.
|
|
746
|
+
- Fix Math: validate and repair LaTeX formulas with optional LLM assistance.
|
|
747
|
+
- Fix Mermaid: validate and repair Mermaid diagrams (requires `mmdc` from mermaid-cli).
|
|
748
|
+
- Recommended order: `fix` -> `fix-math` -> `fix-mermaid` -> `fix`.
|
|
749
|
+
|
|
750
|
+
```bash
|
|
751
|
+
uv run deepresearch-flow recognize md embed --input ./raw_ocr --output ./clean_md
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
```bash
|
|
755
|
+
# Organize MinerU output and apply OCR fixes
|
|
756
|
+
uv run deepresearch-flow recognize organize \
|
|
757
|
+
--input ./mineru_outputs \
|
|
758
|
+
--output-simple ./ocr_md \
|
|
759
|
+
--fix
|
|
760
|
+
|
|
761
|
+
# Fix and format existing markdown outputs
|
|
762
|
+
uv run deepresearch-flow recognize fix \
|
|
763
|
+
--input ./ocr_md \
|
|
764
|
+
--output ./ocr_md_fixed
|
|
765
|
+
|
|
766
|
+
# Fix in place
|
|
767
|
+
uv run deepresearch-flow recognize fix \
|
|
768
|
+
--input ./ocr_md \
|
|
769
|
+
--in-place
|
|
770
|
+
|
|
771
|
+
# Fix JSON outputs in place
|
|
772
|
+
uv run deepresearch-flow recognize fix \
|
|
773
|
+
--json \
|
|
774
|
+
--input ./paper_outputs \
|
|
775
|
+
--in-place
|
|
776
|
+
|
|
777
|
+
# Fix LaTeX formulas in markdown
|
|
778
|
+
uv run deepresearch-flow recognize fix-math \
|
|
779
|
+
--input ./docs \
|
|
780
|
+
--model openai/gpt-4o-mini \
|
|
781
|
+
--in-place
|
|
782
|
+
|
|
783
|
+
# Fix Mermaid diagrams in JSON outputs
|
|
784
|
+
uv run deepresearch-flow recognize fix-mermaid \
|
|
785
|
+
--json \
|
|
786
|
+
--input ./paper_outputs \
|
|
787
|
+
--model openai/gpt-4o-mini \
|
|
788
|
+
--in-place
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
</details>
|
|
792
|
+
|
|
793
|
+
---
|
|
794
|
+
|
|
795
|
+
## Docker Support
|
|
796
|
+
|
|
797
|
+
Don't want to manage Python environments?
|
|
798
|
+
|
|
799
|
+
```bash
|
|
800
|
+
docker run --rm -v $(pwd):/app -it ghcr.io/nerdneilsfield/deepresearch-flow:latest --help
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
Deploy image (API + frontend via nginx):
|
|
804
|
+
|
|
805
|
+
```bash
|
|
806
|
+
docker run --rm -p 8899:8899 \
|
|
807
|
+
-v $(pwd)/paper_snapshot.db:/db/papers.db \
|
|
808
|
+
-v $(pwd)/paper-static:/static \
|
|
809
|
+
ghcr.io/nerdneilsfield/deepresearch-flow:deploy-latest
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
Notes:
|
|
813
|
+
- nginx listens on 8899 and proxies `/api` to the internal API at `127.0.0.1:8000`.
|
|
814
|
+
- Mount your snapshot DB to `/db/papers.db` inside the container.
|
|
815
|
+
- Mount snapshot static assets to `/static` when serving assets from this container (default `PAPER_DB_STATIC_BASE` is `/static`).
|
|
816
|
+
- If `PAPER_DB_STATIC_BASE` is a full URL (e.g. `https://static.example.com`), nginx still serves the frontend locally, while API responses use that external static base for asset links.
|
|
817
|
+
|
|
818
|
+
Docker Compose example (two modes):
|
|
819
|
+
|
|
820
|
+
```bash
|
|
821
|
+
docker compose -f scripts/docker/docker-compose.example.yml --profile local-static up
|
|
822
|
+
# or
|
|
823
|
+
docker compose -f scripts/docker/docker-compose.example.yml --profile external-static up
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
External static assets example:
|
|
827
|
+
|
|
828
|
+
```bash
|
|
829
|
+
docker run --rm -p 8899:8899 \
|
|
830
|
+
-v $(pwd)/paper_snapshot.db:/db/papers.db \
|
|
831
|
+
-e PAPER_DB_STATIC_BASE=https://static.example.com \
|
|
832
|
+
ghcr.io/nerdneilsfield/deepresearch-flow:deploy-latest
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
## Configuration
|
|
836
|
+
|
|
837
|
+
The config.toml is your control center. It supports:
|
|
838
|
+
|
|
839
|
+
- Multiple Providers: mix and match OpenAI, DeepSeek (DashScope), Gemini, Claude, and Ollama.
|
|
840
|
+
- Model Routing: explicit routing to specific models (`--model provider/model_name`).
|
|
841
|
+
- Environment Variables: keep secrets safe using `env:VAR_NAME` syntax.
|
|
842
|
+
|
|
843
|
+
See `config.example.toml` for a full reference.
|
|
844
|
+
|
|
845
|
+
---
|
|
846
|
+
|
|
847
|
+
<p align="center">
|
|
848
|
+
Built with love for the Open Science community.
|
|
849
|
+
</p>
|