LearningCircuit/local-deep-research
GitHub: LearningCircuit/local-deep-research
一款本地优先的 AI 深度研究工具,支持多源检索、知识库构建和带引用的自动报告生成。
Stars: 4246 | Forks: 408
# Local Deep Research
[](https://github.com/LearningCircuit/local-deep-research/stargazers)
[](https://hub.docker.com/r/localdeepresearch/local-deep-research)
[](https://pypi.org/project/local-deep-research/)
[](https://trendshift.io/repositories/14116)
[](https://github.com/LearningCircuit/local-deep-research/commits/main)
[](https://github.com/LearningCircuit/local-deep-research/commits/main)
[](https://github.com/LearningCircuit/local-deep-research/tree/main/community_benchmark_results)
[](docs/SQLCIPHER_INSTALL.md)
[](https://securityscorecards.dev/viewer/?uri=github.com/LearningCircuit/local-deep-research)
[](https://github.com/LearningCircuit/local-deep-research/security/code-scanning)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/semgrep.yml)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/pre-commit.yml)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/docker-publish.yml)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/publish.yml)
[](https://discord.gg/ttcqQeFcJ3)
[](https://www.reddit.com/r/LocalDeepResearch/)
[](https://www.youtube.com/@local-deep-research)
**由 AI 驱动的研究助手,用于深度、智能体式研究**
*利用多种 LLM 和搜索引擎进行深度、智能体式研究,并提供规范的引用*
▶️ 观看 The Art Of The Terminal 的评测
## 🚀 什么是 Local Deep Research?
你掌控的 AI 研究助手。在本地运行以保护隐私,使用任何 LLM 并构建你自己的可搜索知识库。你拥有自己的数据,并能确切了解它是如何工作的。
## ⚡ 快速开始
**选项 1:Docker Run (Linux)**
```
# 步骤 1:拉取并运行 Ollama
docker run -d -p 11434:11434 --name ollama ollama/ollama
docker exec ollama ollama pull gpt-oss:20b
# 步骤 2:拉取并运行 SearXNG 以获得最佳搜索结果
docker run -d -p 8080:8080 --name searxng searxng/searxng
# 步骤 3:拉取并运行 Local Deep Research
docker run -d -p 5000:5000 --network host \
--name local-deep-research \
--volume "deep-research:/data" \
-e LDR_DATA_DIR=/data \
localdeepresearch/local-deep-research
```
**选项 2:Docker Compose**
仅 CPU(所有平台):
```
curl -O https://raw.githubusercontent.com/LearningCircuit/local-deep-research/main/docker-compose.yml && docker compose up -d
```
带 NVIDIA GPU(Linux):
```
curl -O https://raw.githubusercontent.com/LearningCircuit/local-deep-research/main/docker-compose.yml && \
curl -O https://raw.githubusercontent.com/LearningCircuit/local-deep-research/main/docker-compose.gpu.override.yml && \
docker compose -f docker-compose.yml -f docker-compose.gpu.override.yml up -d
```
约 30 秒后打开 http://localhost:5000。有关 GPU 设置、环境变量等更多信息,请参阅 [Docker Compose 指南](docs/docker-compose-guide.md)。
**选项 3:pip install**
```
pip install local-deep-research
```
[更多安装选项 →](#-installation-options)
## 🏗️ 工作原理
### 研究
你提出一个复杂的问题。LDR 会:
- 自动为你进行研究
- 搜索网络、学术论文和你自己的文档
- 将所有内容综合成带有规范引用的报告
从 20 多种研究策略中进行选择,用于快速查询事实、深度分析或学术研究。
**新功能:LangGraph Agent 策略** — 一种自主智能体研究模式,由 LLM 决定搜索什么、使用哪些专业引擎(arXiv、PubMed、Semantic Scholar 等)以及何时进行综合。早期结果很有希望 —— 它会根据发现的内容自适应地切换搜索引擎,并收集比基于流水线的策略多得多的来源。在设置中选择 `langgraph-agent` 进行尝试。
### 构建你的知识库
```
flowchart LR
R[Research] --> D[Download Sources]
D --> L[(Library)]
L --> I[Index & Embed]
I --> S[Search Your Docs]
S -.-> R
```
每次研究会话都会发现有价值的来源。将它们直接下载到你的加密文库中 —— 来自 ArXiv 的学术论文、PubMed 文章、网页。LDR 提取文本、索引所有内容并使其可搜索。下次研究时,你可以同时在自己的文档和实时网络中提问。你的知识会随着时间的推移而积累。
## 🛡️ 安全性
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/devskim.yml)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/bearer.yml)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/gitleaks-main.yml)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/osv-scanner.yml)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/npm-audit.yml)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/retirejs.yml)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/container-security.yml)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/dockle.yml)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/hadolint.yml)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/checkov.yml)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/zizmor-security.yml)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/owasp-zap-scan.yml)
[](https://github.com/LearningCircuit/local-deep-research/actions/workflows/security-tests.yml)
```
flowchart LR
U1[User A] --> D1[(Encrypted DB)]
U2[User B] --> D2[(Encrypted DB)]
```
你的数据归你所有。每个用户都拥有独立的 SQLCipher 数据库,使用 AES-256 加密(Signal 级别的安全性)。无法恢复密码意味着真正的零知识 —— 即使是服务器管理员也无法读取你的数据。配合 Ollama + SearXNG 完全在本地运行,数据永远不会离开你的设备。
**内存中的凭证**:就像所有在运行时使用机密的应用程序一样 —— 包括[密码管理器](https://www.ise.io/casestudies/password-manager-hacking/)、浏览器和 API 客户端 —— 凭证在活动会话期间以明文形式保存在进程内存中。这是[业界普遍接受的现实](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html),并非 LDR 特有:如果攻击者能够读取进程内存,他们也能读取任何进程内的解密密钥。我们通过会话范围的凭证生命周期和核心转储排除来缓解这一问题。如果你有进一步改进的想法,欢迎通过 [GitHub Issues](https://github.com/LearningCircuit/local-deep-research/issues) 告诉我们。详情请参阅我们的[安全策略](SECURITY.md)。
**供应链安全**:Docker 镜像使用 [Cosign](https://github.com/sigstore/cosign) 签名,包含 SLSA 来源证明,并附带 SBOM。使用以下命令验证:
```
cosign verify localdeepresearch/local-deep-research:latest
```
**安全透明度**:扫描抑制在[安全警报评估](.github/SECURITY_ALERTS.md)、[Scorecard 合规性](.github/SECURITY_SCORECARD.md)、[容器 CVE 抑制](.trivyignore)和[SAST 规则理由](bearer.yml)中进行了记录和说明。某些警报(Dependabot、代码扫描)只能被忽略,或者在 [GitHub Security 标签页](https://docs.github.com/en/code-security/dependabot/dependabot-alerts/viewing-and-updating-dependabot-alerts)之外很难抑制,因此上述文件并未涵盖所有被忽略的发现。
[详细架构 →](docs/architecture.md) | [安全策略 →](SECURITY.md) | [安全审查流程 →](docs/SECURITY_REVIEW_PROCESS.md)
### 🔒 隐私与数据
Local Deep Research **不含遥测、分析和跟踪功能**。我们不会收集、传输或存储有关您或您使用情况的任何数据。没有分析 SDK,没有回传电话,没有崩溃报告,没有外部脚本。使用指标保留在您的本地加密数据库中。
LDR 进行的唯一网络调用是**您**发起的:搜索查询(发送给您配置的引擎)、LLM API 调用(发送给您选择的提供商)和通知(仅在您设置 Apprise 的情况下)。
由于我们不收集任何使用数据,我们依靠您来告诉我们什么有效、什么坏了以及您希望看到什么 —— [错误报告](https://github.com/LearningCircuit/local-deep-research/issues)、功能想法,甚至您喜欢或从未使用的功能都有助于我们改进 LDR。
## 📊 性能
**在 SimpleQA 基准测试中准确率约为 95%**(初步结果)
- 使用 GPT-4.1-mini + SearXNG + focused-iteration 策略进行测试
- 与最先进的 AI 研究系统相当
- 本地模型通过适当配置可以达到类似的性能
- [加入我们的社区基准测试工作 →](https://github.com/LearningCircuit/local-deep-research/tree/main/community_benchmark_results)
## ✨ 核心特性
### 🔍 研究模式
- **快速摘要** - 在 30 秒到 3 分钟内获得带引用的答案
- **详细研究** - 具有结构化发现的全面分析
- **报告生成** - 带有章节和目录的专业报告
- **文档分析** - 使用 AI 搜索您的私人文档
### 🛠️ 高级功能
- **[LangChain 集成](docs/LANGCHAIN_RETRIEVER_INTEGRATION.md)** - 使用任何向量存储作为搜索引擎
- **[REST API](docs/api-quickstart.md)** - 具有每用户数据库的经过身份验证的 HTTP 访问
- **[基准测试](docs/BENCHMARKING.md)** - 测试和优化您的配置
- **[分析仪表板](docs/analytics-dashboard.md)** - 跟踪成本、性能和使用指标
- **实时更新** - WebSocket 支持,实时显示研究进度
- **导出选项** - 将结果下载为 PDF 或 Markdown
- **研究历史** - 保存、搜索和重访过去的研究
- **自适应速率限制** - 学习最佳等待时间的智能重试系统
- **键盘快捷键** - 高效导航(ESC、Ctrl+Shift+1-5)
- **每用户加密数据库** - 为每个用户提供安全、隔离的数据存储
### 📰 新闻与研究订阅
- **自动研究摘要** - 订阅主题并接收 AI 驱动的研究摘要
- **可自定义频率** - 每日、每周或自定义研究更新计划
- **智能过滤** - AI 仅过滤和总结最相关的发展
- **多格式交付** - 以 Markdown 报告或结构化摘要的形式获取更新
- **主题与查询支持** - 跟踪特定搜索或广泛的研究领域
### 🌐 搜索来源
#### 免费搜索引擎
- **学术**:arXiv、PubMed、Semantic Scholar
- **通用**:Wikipedia、SearXNG
- **技术**:GitHub、Elasticsearch
- **历史**:Wayback Machine
- **新闻**:The Guardian、Wikinews
#### 付费搜索引擎
- **Tavily** - AI 驱动的搜索
- **Google** - 通过 SerpAPI 或 Programmable Search Engine
- **Brave Search** - 注重隐私的网络搜索
#### 自定义来源
- **本地文档** - 使用 AI 搜索您的文件
- **LangChain Retrievers** - 任何向量存储或数据库
- **元搜索** - 智能组合多个引擎
[完整搜索引擎指南 →](docs/search-engines.md)
## 📦 安装选项
对于大多数用户,上面的[快速开始](#-quick-start)就足够了。
| 方式 | 适用对象 | 指南 |
|--------|----------|-------|
| Docker Compose | 大多数用户(推荐) | [Docker Compose 指南](docs/docker-compose-guide.md) |
| Docker | 最小化设置 | [安装指南](docs/installation.md#docker) |
| pip | 开发者,Python 集成 | [pip 指南](docs/install-pip.md) |
| Unraid | Unraid 服务器 | [Unraid 指南](docs/deployment/unraid.md) |
[所有安装选项 →](docs/installation.md)
## 💻 使用示例
### Python API
```
from local_deep_research.api import LDRClient, quick_query
# 选项 1:最简单 - 单行研究
summary = quick_query("username", "password", "What is quantum computing?")
print(summary)
# 选项 2:用于多重操作的 Client
client = LDRClient()
client.login("username", "password")
result = client.quick_research("What are the latest advances in quantum computing?")
print(result["summary"])
```
### HTTP API
*下面的代码示例展示了基本的 API 结构 —— 有关可工作的示例,请参阅下面的链接*
```
import requests
from bs4 import BeautifulSoup
# 创建会话并进行认证
session = requests.Session()
login_page = session.get("http://localhost:5000/auth/login")
soup = BeautifulSoup(login_page.text, "html.parser")
login_csrf = soup.find("input", {"name": "csrf_token"}).get("value")
# 登录并获取 API CSRF token
session.post("http://localhost:5000/auth/login",
data={"username": "user", "password": "pass", "csrf_token": login_csrf})
csrf = session.get("http://localhost:5000/auth/csrf-token").json()["csrf_token"]
# 发出 API 请求
response = session.post("http://localhost:5000/api/start_research",
json={"query": "Your research question"},
headers={"X-CSRF-Token": csrf})
```
🚀[即用型 HTTP API 示例 → examples/api_usage/http/](examples/api_usage/http/)**
- ✅ **自动用户创建** - 开箱即用
- ✅ **完整的身份验证** - 包含 CSRF 处理
- ✅ **结果重试逻辑** - 等待研究完成
- ✅ **进度监控**和错误处理
### 命令行工具
```
# 从 CLI 运行 benchmarks
python -m local_deep_research.benchmarks --dataset simpleqa --examples 50
# 管理 rate limiting
python -m local_deep_research.web_search_engines.rate_limiting status
python -m local_deep_research.web_search_engines.rate_limiting reset
```
## 🔗 企业集成
将 LDR 连接到您现有的知识库:
```
from local_deep_research.api import quick_summary
# 使用您现有的 LangChain retriever
result = quick_summary(
query="What are our deployment procedures?",
retrievers={"company_kb": your_retriever},
search_tool="company_kb"
)
```
支持:FAISS、Chroma、Pinecone、Weaviate、Elasticsearch 以及任何兼容 LangChain 的检索器。
[集成指南 →](docs/LANGCHAIN_RETRIEVER_INTEGRATION.md)
## 🔌 MCP 服务器(Claude 集成)
LDR 提供了一个 MCP (Model Context Protocol) 服务器,允许像 Claude Desktop 和 Claude Code 这样的 AI 助手进行深度研究。
### 安装
```
# 使用 MCP extras 安装
pip install "local-deep-research[mcp]"
```
### Claude Desktop 配置
添加到您的 `claude_desktop_config.json`:
```
{
"mcpServers": {
"local-deep-research": {
"command": "ldr-mcp",
"env": {
"LDR_LLM_PROVIDER": "openai",
"LDR_LLM_OPENAI_API_KEY": "sk-..."
}
}
}
}
```
### Claude Code 配置
添加到您的 `.mcp.json`(项目级)或 `~/.claude/mcp.json`(全局):
```
{
"mcpServers": {
"local-deep-research": {
"command": "ldr-mcp",
"env": {
"LDR_LLM_PROVIDER": "ollama",
"LDR_LLM_OLLAMA_URL": "http://localhost:11434"
}
}
}
}
```
### 可用工具
| 工具 | 描述 | 耗时 | LLM 成本 |
|------|-------------|----------|----------|
| `search` | 来自特定引擎的原始结果 | 5-30s | None |
| `quick_research` | 快速研究摘要 | 1-5 min | Yes |
| `detailed_research` | 全面分析 | 5-15 min | Yes |
| `generate_report` | 完整的 Markdown 报告 | 10-30 min | Yes |
| `analyze_documents` | 搜索本地集合 | 30s-2 min | Yes |
| `list_search_engines` | 列出可用的搜索引擎 | instant | None |
| `list_strategies` | 列出研究策略 | instant | None |
| `get_configuration` | 获取当前配置 | instant | None |
### 单独搜索引擎
`search` 工具允许您直接查询特定的搜索引擎并获取原始结果 —— 无需 LLM 处理,无成本,速度快。这对于**监控和订阅**特别有用,因为您可以定期检查新内容,而无需消耗 LLM tokens。
```
# 在 arXiv 上搜索最新论文
search(query="transformer architecture improvements", engine="arxiv")
# 在 PubMed 上搜索医学文献
search(query="CRISPR clinical trials 2024", engine="pubmed")
# 在 Wikipedia 上搜索快速事实
search(query="quantum error correction", engine="wikipedia")
# 在 OpenClaw 上搜索法律判例
search(query="copyright fair use precedents", engine="openclaw")
# 使用 list_search_engines() 查看所有可用引擎
```
### 使用示例
```
"Use quick_research to find information about quantum computing applications"
"Search arxiv for recent papers on diffusion models"
"Generate a detailed research report on renewable energy trends"
```
## 📊 性能与分析
### 基准测试结果
在小型 SimpleQA 数据集样本上的早期实验:
| 配置 | 准确率 | 备注 |
|--------------|----------|--------|
| gpt-4.1-mini + SearXNG + focused_iteration | 90-95% | 样本量有限 |
| gpt-4.1-mini + Tavily + focused_iteration | 90-95% | 样本量有限 |
| gemini-2.0-flash-001 + SearXNG | 82% | 单次测试运行 |
注意:这些是初步测试的初步结果。性能会因查询类型、模型版本和配置而有很大差异。[运行您自己的基准测试 →](docs/BENCHMARKING.md)
### 内置分析仪表板
通过详细的指标跟踪成本、性能和使用情况。[了解更多 →](docs/analytics-dashboard.md)
## 🤖 支持的 LLM
### 本地模型(通过 Ollama)
- Llama 3、Mistral、Gemma、DeepSeek
- LLM 处理在本地进行(搜索查询仍需联网)
- 无 API 成本
### 云端模型
- OpenAI (GPT-4, GPT-3.5)
- Anthropic (Claude 3)
- Google (Gemini)
- 通过 OpenRouter 支持 100 多种模型
[模型设置 →](docs/env_configuration.md)
## 📚 文档
### 入门指南
- [安装指南](docs/installation.md)
- [常见问题解答](docs/faq.md)
- [API 快速入门](docs/api-quickstart.md)
- [配置指南](docs/env_configuration.md)
- [完整配置参考](docs/CONFIGURATION.md)
### 核心功能
- [所有功能指南](docs/features.md)
- [搜索引擎指南](docs/search-engines.md)
- [分析仪表板](docs/analytics-dashboard.md)
### 高级功能
- [LangChain 集成](docs/LANGCHAIN_RETRIEVER_INTEGRATION.md)
- [基准测试系统](docs/BENCHMARKING.md)
- [Elasticsearch 设置](docs/elasticsearch_search_engine.md)
- [SearXNG 设置](docs/SearXNG-Setup.md)
### 开发
- [Docker Compose 指南](docs/docker-compose-guide.md)
- [开发指南](docs/developing.md)
- [安全指南](docs/security/CODEQL_GUIDE.md)
- [发布指南](docs/RELEASE_GUIDE.md)
### 示例与教程
- [API 示例](examples/api_usage/)
- [基准测试示例](examples/benchmarks/)
- [优化示例](examples/optimization/)
## 📰 媒体报道
### 新闻与文章
- [Korben.info](https://korben.info/local-deep-research-alternative-gratuite-recherche-ia-sourcee.html) - 法国科技博客(“数字时代的福尔摩斯”)
- [Roboto.fr](https://www.roboto.fr/blog/local-deep-research-l-alternative-open-source-gratuite-deep-research-d-openai) - “OpenAI Deep Research 的免费开源替代方案”
- [KDJingPai AI Tools](https://www.kdjingpai.com/en/local-deep-research/) - AI 生产力工具报道
- [AI Sharing Circle](https://aisharenet.com/en/local-deep-research/) - AI 资源报道
### 社区讨论
- [Hacker News](https://news.ycombinator.com/item?id=43330164) - 190+ 赞,社区讨论
- [LangChain Twitter/X](https://x.com/LangChainAI/status/1901347759757902038) - LangChain 官方推广
- [LangChain LinkedIn](https://www.linkedin.com/posts/langchain_local-deep-research-an-ai-research-activity-7307113456095137792-cXRH) - 400+ 赞
### 国际报道
#### 🇨🇳 中文
- [掘金](https://juejin.cn/post/7481604667589885991) - 开发者社区
- [博客园](https://www.cnblogs.com/qife122/p/18955032) - 开发者博客
- [GitHubDaily (Twitter/X)](https://x.com/GitHub_Daily/status/1900169979313741846) - 知名科技账号
- [知乎](https://zhuanlan.zhihu.com/p/30886269290) - 科技社区
- [A姐分享](https://www.ahhhhfs.com/68713/) - AI 资源
- [CSDN](https://blog.csdn.net/gitblog_01198/article/details/147061415) - 安装指南
- [网易](https://www.163.com/dy/article/JQKAS50205567BLV.html) - 科技新闻门户
#### 🇯🇵 日语
- [note.com: 調査革命:Local Deep Research徹底活用法](https://note.com/r7038xx/n/nb3b74debbb30) - 全面教程
- [Qiita: Local Deep Researchを試す](https://qiita.com/orca13/items/635f943287c45388d48f) - Docker 设置指南
- [LangChainJP (Twitter/X)](https://x.com/LangChainJP/status/1902918110073807073) - 日本 LangChain 社区
#### 🇰🇷 韩语
- [PyTorch Korea Forum](https://discuss.pytorch.kr/t/local-deep-research/6476) - 韩国 ML 社区
- [GeekNews (Hada.io)](https://news.hada.io/topic?id=19707) - 韩国科技新闻
### 评测与分析
- [BSAIL Lab: How useful is Deep Research in Academia?](https://uflbsail.net/uncategorized/how-useful-is-deep-research-in-academia/) - 贡献者 [@djpetti](https://github.com/djpetti) 的学术评论
- [The Art Of The Terminal: Use Local LLMs Already!](https://youtu.be/pfxgLX-MxMY?t=1999) - 本地 AI 工具的全面评测,重点介绍了 LDR 的研究功能(embeddings 现已可用!)
### 相关项目
- [SearXNG LDR-Academic](https://github.com/porespellar/searxng-LDR-academic) - 面向学术的 SearXNG 分支,包含 12 个研究引擎(arXiv、Google Scholar、PubMed 等),专为 LDR 设计
- [DeepWiki Documentation](https://deepwiki.com/LearningCircuit/local-deep-research) - 第三方文档和指南
## 🤝 社区与支持
- [Discord](https://discord.gg/ttcqQeFcJ3) - 获取帮助并分享研究技巧
- [Reddit](https://www.reddit.com/r/LocalDeepResearch/) - 更新与展示
- [GitHub Issues](https://github.com/LearningCircuit/local-deep-research/issues) - 错误报告
## 🚀 贡献
我们欢迎各种规模的贡献 —— 从修复拼写错误到新功能。关键规则:**保持 PR 小而原子化**(每个 PR 一个更改)。对于较大的更改,请先提出 issue 或发起讨论 —— 我们希望保护您的时间,并确保您的努力能促成成功的合并,而不是一个方向跑偏的 PR。请参阅我们的[贡献指南](CONTRIBUTING.md)开始吧。
## 📄 许可证
MIT 许可证 - 详见 [LICENSE](LICENSE) 文件。
**依赖项:** 所有第三方软件包均使用宽松许可证(MIT、Apache-2.0、BSD 等) - 请参阅[允许列表](.github/workflows/dependency-review.yml#L50-L68)
构建技术:[LangChain](https://github.com/hwchase17/langchain)、[Ollama](https://ollama.ai)、[SearXNG](https://searxng.org/)、[FAISS](https://github.com/facebookresearch/faiss)标签:AI风险缓解, Anthropic, arXiv, CIS基准, DLL 劫持, Docker, GPT-4, LLM, LLM评估, Ollama, PubMed, Python, RAG, Ruby, SimpleQA, SQLCipher, Unmanaged PE, 人工智能, 大语言模型, 安全, 安全防御评估, 开源, 数据加密, 文献检索, 无后门, 本地深度研究, 本地部署, 检索增强生成, 用户模式Hook绕过, 知识库, 私有文档搜索, 端侧AI, 网络安全, 自动化研究, 请求拦截, 超时处理, 逆向工具, 隐私保护