From fc77fbf0231c28f69837d2b9dc2cbf8b822fb38f Mon Sep 17 00:00:00 2001 From: wehub-resource-sync Date: Mon, 13 Jul 2026 10:47:37 +0000 Subject: [PATCH] docs: make Chinese README the default --- README.md | 716 +++++++++++++++++++++++++++--------------------------- 1 file changed, 361 insertions(+), 355 deletions(-) diff --git a/README.md b/README.md index 468027d..cd37f82 100755 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ + +> [!NOTE] +> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。 +> [English](./README.en.md) · [原始项目](https://github.com/StarTrail-org/LEANN) · [上游 README](https://github.com/StarTrail-org/LEANN/blob/HEAD/README.md) +> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。 +

LEANN Logo

@@ -9,92 +15,92 @@

- Python Versions - CI Status - Platform - MIT License - MCP Integration + Python 版本 + CI 状态 + 平台 + MIT 许可证 + MCP 集成 - Join Slack + 加入 Slack

- Take Survey + 参与调查

- We track zero telemetry. This survey is the ONLY way to tell us if you want
- GPU Acceleration or More Integrations next.
- 👉 Click here to cast your vote (2 mins) + 我们零遥测。这份调查是你告诉我们接下来更想要
+ GPU 加速还是更多集成的唯一途径。
+ 👉 点击此处投票(约 2 分钟)

-

💬 Join our Slack community!

+

💬 加入我们的 Slack 社区!

- We'd love for you to be part of the LEANN community!
- 👉 Join LEANN Slack
- If the invite link has expired or you have trouble joining, please open an issue and we'll help you get in! + 我们诚挚邀请你加入 LEANN 社区!
+ 👉 加入 LEANN Slack
+ 如果邀请链接已过期或加入遇到问题,请提交 issue,我们会协助你加入!

- The smallest vector index in the world. RAG Everything with LEANN! + 世界上最小的向量索引。用 LEANN RAG Everything!

-LEANN is an innovative vector database that democratizes personal AI. Transform your laptop into a powerful RAG system that can index and search through millions of documents while using **97% less storage** than traditional solutions **without accuracy loss**. +LEANN 是一款创新的向量数据库,让个人 AI 触手可及。将你的笔记本电脑变成强大的 RAG 系统,可索引并搜索数百万份文档,相比传统方案存储占用减少 97%,且不损失精度。 -LEANN achieves this through *graph-based selective recomputation* with *high-degree preserving pruning*, computing embeddings on-demand instead of storing them all. [Illustration Fig →](#️-architecture--how-it-works) | [Paper →](https://arxiv.org/abs/2506.08276) +LEANN 通过基于图的选择性重计算高度保留剪枝实现这一目标,按需计算嵌入向量,而非全部存储。[架构示意图 →](#️-architecture--how-it-works) | [论文 →](https://arxiv.org/abs/2506.08276) -**Ready to RAG Everything?** Transform your laptop into a personal AI assistant that can semantic search your **[file system](#-personal-data-manager-process-any-documents-pdf-txt-md)**, **[emails](#-your-personal-email-secretary-rag-on-apple-mail)**, **[browser history](#-time-machine-for-the-web-rag-your-entire-browser-history)**, **[chat history](#-wechat-detective-unlock-your-golden-memories)** ([WeChat](#-wechat-detective-unlock-your-golden-memories), [iMessage](#-imessage-history-your-personal-conversation-archive)), **[agent memory](#-chatgpt-chat-history-your-personal-ai-conversation-archive)** ([ChatGPT](#-chatgpt-chat-history-your-personal-ai-conversation-archive), [Claude](#-claude-chat-history-your-personal-ai-conversation-archive)), **[live data](#mcp-integration-rag-on-live-data-from-any-platform)** ([Slack](#slack-messages-search-your-team-conversations), [Twitter](#-twitter-bookmarks-your-personal-tweet-library)), **[codebase](#-claude-code-integration-transform-your-development-workflow)**\*, or external knowledge bases (i.e., 60M documents) - all on your laptop, with zero cloud costs and complete privacy. +准备好 RAG Everything 了吗? 将你的笔记本电脑变成个人 AI 助手,可对[文件系统](#-personal-data-manager-process-any-documents-pdf-txt-md)[邮件](#-your-personal-email-secretary-rag-on-apple-mail)[浏览器历史](#-time-machine-for-the-web-rag-your-entire-browser-history)[聊天记录](#-wechat-detective-unlock-your-golden-memories)([WeChat](#-wechat-detective-unlock-your-golden-memories)、[iMessage](#-imessage-history-your-personal-conversation-archive))、[智能体记忆](#-chatgpt-chat-history-your-personal-ai-conversation-archive)([ChatGPT](#-chatgpt-chat-history-your-personal-ai-conversation-archive)、[Claude](#-claude-chat-history-your-personal-ai-conversation-archive))、[实时数据](#mcp-integration-rag-on-live-data-from-any-platform)([Slack](#slack-messages-search-your-team-conversations)、[Twitter](#-twitter-bookmarks-your-personal-tweet-library))、[代码库](#-claude-code-integration-transform-your-development-workflow)*,或外部知识库(例如 6000 万份文档)进行语义搜索——全部在你的笔记本电脑上完成,零云成本,完全隐私。 -\* Claude Code only supports basic `grep`-style keyword search. **LEANN** is a drop-in **semantic search MCP service fully compatible with Claude Code**, unlocking intelligent retrieval without changing your workflow. 🔥 Check out [the easy setup →](packages/leann-mcp/README.md) +* Claude Code 仅支持基础的 `grep` 风格关键词搜索。LEANN 是一款可即插即用的语义搜索 MCP 服务,与 Claude Code 完全兼容,无需改变你的工作流即可解锁智能检索。🔥 查看[简易配置 →](packages/leann-mcp/README.md) -## Why LEANN? +## 为什么选择 LEANN?

- LEANN vs Traditional Vector DB Storage Comparison + LEANN 与传统向量数据库存储对比

-> **The numbers speak for themselves:** Index 60 million text chunks in just 6GB instead of 201GB. From emails to browser history, everything fits on your laptop. [See detailed benchmarks for different applications below ↓](#-storage-comparison) +> 数据不言自明: 仅 6GB 即可索引 6000 万条文本块,而非 201GB。从邮件到浏览器历史,一切都能装进你的笔记本电脑。[查看下方不同应用的详细基准测试 ↓](#-storage-comparison) -🔒 **Privacy:** Your data never leaves your laptop. No OpenAI, no cloud, no "terms of service". +🔒 隐私: 你的数据永不离开笔记本电脑。无需 OpenAI、无需云端、没有「服务条款」。 -🪶 **Lightweight:** Graph-based recomputation eliminates heavy embedding storage, while smart graph pruning and CSR format minimize graph storage overhead. Always less storage, less memory usage! +🪶 轻量: 基于图的重计算消除了沉重的嵌入存储负担,智能图剪枝与 CSR 格式将图存储开销降至最低。存储更少、内存占用更低! -📦 **Portable:** Transfer your entire knowledge base between devices (even with others) with minimal cost - your personal AI memory travels with you. +📦 便携: 以极低成本在设备间(甚至与他人)转移整个知识库——你的个人 AI 记忆随身而行。 -📈 **Scalability:** Handle messy personal data that would crash traditional vector DBs, easily managing your growing personalized data and agent generated memory! +📈 可扩展: 处理会让传统向量数据库崩溃的杂乱个人数据,轻松管理不断增长的个人化数据与智能体生成的记忆! -✨ **No Accuracy Loss:** Maintain the same search quality as heavyweight solutions while using 97% less storage. +✨ 无精度损失: 在存储占用减少 97% 的同时,保持与重量级方案相同的搜索质量。 -## Installation +## 安装 -### 📦 Prerequisites: Install uv +### 📦 前置条件:安装 uv -[Install uv](https://docs.astral.sh/uv/getting-started/installation/#installation-methods) first if you don't have it. Typically, you can install it with: +如果尚未安装,请先[安装 uv](https://docs.astral.sh/uv/getting-started/installation/#installation-methods)。通常可通过以下命令安装: ```bash curl -LsSf https://astral.sh/uv/install.sh | sh ``` -### 🚀 Quick Install +### 🚀 快速安装 -Clone the repository to access all examples and try amazing applications, +克隆仓库以访问所有示例并体验精彩应用, ```bash git clone https://github.com/yichuan-w/LEANN.git leann cd leann ``` -and install LEANN from [PyPI](https://pypi.org/project/leann/) to run them immediately: +然后从 [PyPI](https://pypi.org/project/leann/) 安装 LEANN,即可立即运行: ```bash uv venv @@ -105,11 +111,11 @@ uv pip install leann ``` +> 资源有限?请参阅[配置指南](docs/configuration-guide.md#low-resource-setups)中的「低资源配置」。 -->
-🔧 Build from Source (Recommended for development) +🔧 从源码构建(推荐用于开发) @@ -120,20 +126,20 @@ cd leann git submodule update --init --recursive ``` -**macOS:** +macOS: -Note: DiskANN requires MacOS 13.3 or later. +注意:DiskANN 需要 macOS 13.3 或更高版本。 ```bash brew install libomp boost protobuf zeromq pkgconf uv sync --extra diskann ``` -**Linux (Ubuntu/Debian):** +Linux(Ubuntu/Debian): -Note: On Ubuntu 20.04, you may need to build a newer Abseil and pin Protobuf (e.g., v3.20.x) for building DiskANN. See [Issue #30](https://github.com/yichuan-w/LEANN/issues/30) for a step-by-step note. +注意:在 Ubuntu 20.04 上,你可能需要构建较新版本的 Abseil 并固定 Protobuf 版本(例如 v3.20.x)以构建 DiskANN。分步说明请参阅 [Issue #30](https://github.com/yichuan-w/LEANN/issues/30)。 -You can manually install [Intel oneAPI MKL](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html) instead of `libmkl-full-dev` for DiskANN. You can also use `libopenblas-dev` for building HNSW only, by removing `--extra diskann` in the command below. +你可以手动安装 [Intel oneAPI MKL](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html) 替代 `libmkl-full-dev` 用于 DiskANN。你也可以使用 `libopenblas-dev` 仅构建 HNSW,方法是在下方命令中移除 `--extra diskann`。 ```bash sudo apt-get update && sudo apt-get install -y \ @@ -144,7 +150,7 @@ sudo apt-get update && sudo apt-get install -y \ uv sync --extra diskann ``` -**Linux (Arch Linux):** +Linux(Arch Linux): ```bash sudo pacman -Syu && sudo pacman -S --needed base-devel cmake pkgconf git gcc \ @@ -160,9 +166,9 @@ source /opt/intel/oneapi/setvars.sh uv sync --extra diskann ``` -**Linux (RHEL / CentOS Stream / Oracle / Rocky / AlmaLinux):** +Linux(RHEL / CentOS Stream / Oracle / Rocky / AlmaLinux): -See [Issue #50](https://github.com/yichuan-w/LEANN/issues/50) for more details. +更多详情请参阅 [Issue #50](https://github.com/yichuan-w/LEANN/issues/50)。 ```bash sudo dnf groupinstall -y "Development Tools" @@ -177,9 +183,9 @@ source /opt/intel/oneapi/setvars.sh uv sync --extra diskann ``` -**Windows:** +**Windows:** -Requires [Visual Studio 2022 Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022) with the **C++ desktop development** workload, and [vcpkg](https://github.com/microsoft/vcpkg). +需要 [Visual Studio 2022 Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022),并安装 **C++ desktop development** 工作负载,以及 [vcpkg](https://github.com/microsoft/vcpkg). ```powershell # Install toolchain (if not already present) @@ -203,11 +209,11 @@ uv sync --extra diskann
-## Quick Start +## 快速开始 -Our declarative API makes RAG as easy as writing a config file. +我们的声明式 API 让 RAG 像编写配置文件一样简单。 -Check out [demo.ipynb](demo.ipynb) or [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/yichuan-w/LEANN/blob/main/demo.ipynb) +查看 [demo.ipynb](demo.ipynb),或 [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/yichuan-w/LEANN/blob/main/demo.ipynb) ```python from leann import LeannBuilder, LeannSearcher, LeannChat @@ -229,58 +235,58 @@ chat = LeannChat(INDEX_PATH, llm_config={"type": "hf", "model": "Qwen/Qwen3-0.6B response = chat.ask("How much storage does LEANN save?", top_k=1) ``` -## RAG on Everything! +## 万物皆可 RAG! -LEANN supports RAG on various data sources including documents (`.pdf`, `.txt`, `.md`), Apple Mail, Google Search History, WeChat, ChatGPT conversations, Claude conversations, iMessage conversations, and **live data from any platform through MCP (Model Context Protocol) servers** - including Slack, Twitter, and more. +LEANN 支持多种数据源的 RAG,包括文档(`.pdf`、`.txt`、`.md`)、Apple Mail、Google 搜索历史、微信、ChatGPT 对话、Claude 对话、iMessage 对话,以及**通过 MCP(Model Context Protocol,模型上下文协议)服务器从任意平台获取的实时数据**——包括 Slack、Twitter 等。 -### Generation Model Setup +### 生成模型配置 -#### LLM Backend +#### LLM 后端 -LEANN supports many LLM providers for text generation (HuggingFace, Ollama, Anthropic, and Any OpenAI compatible API). +LEANN 支持众多 LLM 提供商进行文本生成(HuggingFace、Ollama、Anthropic 以及任何兼容 OpenAI 的 API)。
-🔑 OpenAI API Setup (Default) +🔑 OpenAI API 配置(默认) -Set your OpenAI API key as an environment variable: +将 OpenAI API 密钥设置为环境变量: ```bash export OPENAI_API_KEY="your-api-key-here" ``` -Make sure to use `--llm openai` flag when using the CLI. -You can also specify the model name with `--llm-model ` flag. +使用 CLI 时,请务必使用 `--llm openai` 标志。 +你也可以通过 `--llm-model ` 标志指定模型名称。
-🛠️ Supported LLM & Embedding Providers (via OpenAI Compatibility) +🛠️ 支持的 LLM 与 Embedding 提供商(通过 OpenAI 兼容性) -Thanks to the widespread adoption of the OpenAI API format, LEANN is compatible out-of-the-box with a vast array of LLM and embedding providers. Simply set the `OPENAI_BASE_URL` and `OPENAI_API_KEY` environment variables to connect to your preferred service. +得益于 OpenAI API 格式的广泛采用,LEANN 开箱即用地兼容大量 LLM 与 embedding 提供商。只需设置 `OPENAI_BASE_URL` 和 `OPENAI_API_KEY` 环境变量,即可连接你偏好的服务。 ```sh export OPENAI_API_KEY="xxx" export OPENAI_BASE_URL="http://localhost:1234/v1" # base url of the provider ``` -To use OpenAI compatible endpoint with the CLI interface: +在 CLI 界面中使用兼容 OpenAI 的端点: -If you are using it for text generation, make sure to use `--llm openai` flag and specify the model name with `--llm-model ` flag. +若用于文本生成,请务必使用 `--llm openai` 标志,并通过 `--llm-model ` 标志指定模型名称。 -If you are using it for embedding, set the `--embedding-mode openai` flag and specify the model name with `--embedding-model `. +若用于 embedding,请设置 `--embedding-mode openai` 标志,并通过 `--embedding-model ` 指定模型名称。 ----- -Below is a list of base URLs for common providers to get you started. +以下是常见提供商的 Base URL 列表,供你快速上手。 -### 🖥️ Local Inference Engines (Recommended for full privacy) +### 🖥️ 本地推理引擎(推荐,可最大程度保护隐私) -| Provider | Sample Base URL | +| 提供商 | 示例 Base URL | | ---------------- | --------------------------- | | **Ollama** | `http://localhost:11434/v1` | | **LM Studio** | `http://localhost:1234/v1` | @@ -291,12 +297,12 @@ Below is a list of base URLs for common providers to get you started. ----- -### ☁️ Cloud Providers +### ☁️ 云服务提供商 -> **🚨 A Note on Privacy:** Before choosing a cloud provider, carefully review their privacy and data retention policies. Depending on their terms, your data may be used for their own purposes, including but not limited to human reviews and model training, which can lead to serious consequences if not handled properly. +> **🚨 隐私提示:** 在选择云服务提供商之前,请仔细查阅其隐私与数据保留政策。根据其条款,你的数据可能被用于其自身目的,包括但不限于人工审核与模型训练;若处理不当,可能带来严重后果。 -| Provider | Base URL | +| 提供商 | Base URL | | ---------------- | ---------------------------------------------------------- | | **OpenAI** | `https://api.openai.com/v1` | | **OpenRouter** | `https://openrouter.ai/api/v1` | @@ -310,9 +316,9 @@ Below is a list of base URLs for common providers to get you started. | **Anthropic** | `https://api.anthropic.com/v1` | | **Jina AI** (Embeddings) | `https://api.jina.ai/v1` | -> **💡 Tip: Separate Embedding Provider** +> **💡 提示:分离 Embedding 提供商** > -> To use a different provider for embeddings (e.g., Jina AI) while using another for LLM, use `--embedding-api-base` and `--embedding-api-key`: +> 若要为 embedding 使用不同的提供商(例如 Jina AI),同时为 LLM 使用另一家,可使用 `--embedding-api-base` 和 `--embedding-api-key`: > ```bash > leann build my-index --docs ./docs \ > --embedding-mode openai \ @@ -321,23 +327,23 @@ Below is a list of base URLs for common providers to get you started. > --embedding-api-key $JINA_API_KEY > ``` -If your provider isn't on this list, don't worry! Check their documentation for an OpenAI-compatible endpoint—chances are, it's OpenAI Compatible too! +若你的提供商不在此列表中,别担心!查看其文档中的 OpenAI 兼容端点——很可能同样兼容 OpenAI!
-🔧 Ollama Setup (Recommended for full privacy) +🔧 Ollama 配置(推荐,可最大程度保护隐私) -**macOS:** +**macOS:** -First, [download Ollama for macOS](https://ollama.com/download/mac). +首先,[下载适用于 macOS 的 Ollama](https://ollama.com/download/mac). ```bash # Pull a lightweight model (recommended for consumer hardware) ollama pull llama3.2:1b ``` -**Linux:** +**Linux:** ```bash # Install Ollama @@ -353,16 +359,16 @@ ollama pull llama3.2:1b
-## ⭐ Flexible Configuration +## ⭐ 灵活配置 -LEANN provides flexible parameters for embedding models, search strategies, and data processing to fit your specific needs. +LEANN 为 embedding 模型、检索策略与数据处理提供灵活参数,以适应你的具体需求。 -📚 **Need configuration best practices?** Check our [Configuration Guide](docs/configuration-guide.md) for detailed optimization tips, model selection advice, and solutions to common issues like slow embeddings or poor search quality. +📚 **需要配置最佳实践?** 查看我们的[配置指南](docs/configuration-guide.md),获取详细优化技巧、模型选择建议,以及 embedding 速度慢或检索质量差等常见问题的解决方案。
-📋 Click to expand: Common Parameters (Available in All Examples) +📋 点击展开:通用参数(所有示例均可用) -All RAG examples share these common parameters. **Interactive mode** is available in all examples - simply run without `--query` to start a continuous Q&A session where you can ask multiple questions. Type 'quit' to exit. +所有 RAG 示例共享这些通用参数。所有示例均支持**交互模式**——只需不带 `--query` 运行,即可启动持续问答会话,连续提问。输入 'quit' 退出。 ```bash # Environment Variables (GPU Device Selection) @@ -402,15 +408,15 @@ LEANN_LLM_DEVICE # GPU for HFChat LLM (e.g., cuda:1, or "cuda" for m
-### 📄 Personal Data Manager: Process Any Documents (`.pdf`, `.txt`, `.md`)! +### 📄 个人数据管理器:处理任意文档(`.pdf`、`.txt`、`.md`)! -Ask questions directly about your personal PDFs, documents, and any directory containing your files! +直接对你的个人 PDF、文档以及包含文件的任意目录提问!

LEANN Document Search Demo

-The example below asks a question about summarizing our paper (uses default data in `data/`, which is a directory with diverse data sources: two papers, Pride and Prejudice, and a Technical report about LLM in Huawei in Chinese), and this is the **easiest example** to run here: +下面的示例会就我们的论文摘要提出问题(使用 `data/` 中的默认数据,该目录包含多种数据源:两篇论文、《傲慢与偏见》,以及一份关于华为 LLM 的中文技术报告),这也是**最容易在此运行的示例**: ```bash source .venv/bin/activate # Don't forget to activate the virtual environment @@ -418,15 +424,15 @@ python -m apps.document_rag --query "What are the main techniques LEANN explores ```
-📋 Click to expand: Document-Specific Arguments +📋 点击展开:文档专用参数 -#### Parameters +#### 参数 ```bash --data-dir DIR # Directory containing documents to process (default: data) --file-types .ext .ext # Filter by specific file types (optional - all LlamaIndex supported types if omitted) ``` -#### Example Commands +#### 示例命令 ```bash # Process all documents with larger chunks for academic papers python -m apps.document_rag --data-dir "~/Documents/Papers" --chunk-size 1024 @@ -443,11 +449,11 @@ python -m apps.code_rag --repo-dir "./my_codebase" --query "How does authenticat
-### 🎨 ColQwen: Multimodal PDF Retrieval with Vision-Language Models +### 🎨 ColQwen:基于视觉语言模型的多模态 PDF 检索 -Search through PDFs using both text and visual understanding with ColQwen2/ColPali models. Perfect for research papers, technical documents, and any PDFs with complex layouts, figures, or diagrams. +使用 ColQwen2/ColPali 模型,结合文本与视觉理解搜索 PDF。非常适合研究论文、技术文档,以及任何版式复杂、包含图表或示意图的 PDF。 -> **🍎 Mac Users**: ColQwen is optimized for Apple Silicon with MPS acceleration for faster inference! +> **🍎 Mac 用户**:ColQwen 针对 Apple Silicon 进行了优化,支持 MPS 加速以提升推理速度! ```bash # Build index from PDFs @@ -461,16 +467,16 @@ python -m apps.colqwen_rag ask research_papers --interactive ```
-📋 Click to expand: ColQwen Setup & Usage +📋 点击展开:ColQwen 设置与用法 -#### Prerequisites +#### 前置条件 ```bash # Install dependencies uv pip install colpali_engine pdf2image pillow matplotlib qwen_vl_utils einops seaborn brew install poppler # macOS only, for PDF processing ``` -#### Build Index +#### 构建索引 ```bash python -m apps.colqwen_rag build \ --pdfs ./pdf_directory/ \ @@ -478,45 +484,45 @@ python -m apps.colqwen_rag build \ --model colqwen2 # or colpali ``` -#### Search +#### 搜索 ```bash python -m apps.colqwen_rag search my_index "your question here" --top-k 5 ``` -#### Models -- **ColQwen2** (`colqwen2`): Latest vision-language model with improved performance -- **ColPali** (`colpali`): Proven multimodal retriever +#### 模型 +- **ColQwen2**(`colqwen2`):最新的视觉语言模型,性能更优 +- **ColPali**(`colpali`):成熟的多模态检索器 -For detailed usage, see the [ColQwen Guide](docs/COLQWEN_GUIDE.md). +详细用法请参阅 [ColQwen 指南](docs/COLQWEN_GUIDE.md)。
-### 📧 Your Personal Email Secretary: RAG on Apple Mail! +### 📧 你的个人邮件秘书:基于 Apple Mail 的 RAG! -> **Note:** The examples below currently support macOS only. Windows support coming soon. +> **注意:** 以下示例目前仅支持 macOS。Windows 支持即将推出。

LEANN Email Search Demo

-Before running the example below, you need to grant full disk access to your terminal/VS Code in System Preferences → Privacy & Security → Full Disk Access. +在运行下面的示例之前,你需要在「系统设置 → 隐私与安全性 → 完全磁盘访问权限」中为终端/VS Code 授予完全磁盘访问权限。 ```bash python -m apps.email_rag --query "What's the food I ordered by DoorDash or Uber Eats mostly?" ``` -**780K email chunks → 78MB storage.** Finally, search your email like you search Google. +**780K 邮件分块 → 78MB 存储空间。** 终于可以像用 Google 搜索一样搜索你的邮件了。
-📋 Click to expand: Email-Specific Arguments +📋 点击展开:邮件专用参数 -#### Parameters +#### 参数 ```bash --mail-path PATH # Path to specific mail directory (auto-detects if omitted) --include-html # Include HTML content in processing (useful for newsletters) ``` -#### Example Commands +#### 示例命令 ```bash # Search work emails from a specific account python -m apps.email_rag --mail-path "~/Library/Mail/V10/WORK_ACCOUNT" @@ -528,15 +534,15 @@ python -m apps.email_rag --query "receipt order confirmation invoice" --include-
-📋 Click to expand: Example queries you can try +📋 点击展开:可尝试的示例查询 -Once the index is built, you can ask questions like: +索引构建完成后,你可以提出如下问题: - "Find emails from my boss about deadlines" - "What did John say about the project timeline?" - "Show me emails about travel expenses"
-### 🔍 Time Machine for the Web: RAG Your Entire Chrome Browser History! +### 🔍 网页时光机:对你的整个 Chrome 浏览历史进行 RAG!

LEANN Browser History Search Demo @@ -545,17 +551,17 @@ Once the index is built, you can ask questions like: ```bash python -m apps.browser_rag --query "Tell me my browser history about machine learning?" ``` -**38K browser entries → 6MB storage.** Your browser history becomes your personal search engine. +**38K 条浏览记录 → 6MB 存储空间。** 让你的浏览历史成为你的个人搜索引擎。

-📋 Click to expand: Browser-Specific Arguments +📋 点击展开:浏览器专用参数 -#### Parameters +#### 参数 ```bash --chrome-profile PATH # Path to Chrome profile directory (auto-detects if omitted) ``` -#### Example Commands +#### 示例命令 ```bash # Search academic research from your browsing history python -m apps.browser_rag --query "arxiv papers machine learning transformer architecture" @@ -567,25 +573,25 @@ python -m apps.browser_rag --chrome-profile "~/Library/Application Support/Googl
-📋 Click to expand: How to find your Chrome profile +📋 点击展开:如何找到你的 Chrome 配置文件 -The default Chrome profile path is configured for a typical macOS setup. If you need to find your specific Chrome profile: +默认 Chrome 配置文件路径已针对典型的 macOS 环境进行配置。如需找到你的具体 Chrome 配置文件: -1. Open Terminal -2. Run: `ls ~/Library/Application\ Support/Google/Chrome/` -3. Look for folders like "Default", "Profile 1", "Profile 2", etc. -4. Use the full path as your `--chrome-profile` argument +1. 打开终端(Terminal) +2. 运行:`ls ~/Library/Application\ Support/Google/Chrome/` +3. 查找类似 "Default"、"Profile 1"、"Profile 2" 等的文件夹 +4. 将完整路径用作 `--chrome-profile` 参数 -**Common Chrome profile locations:** -- macOS: `~/Library/Application Support/Google/Chrome/Default` -- Linux: `~/.config/google-chrome/Default` +**常见 Chrome 配置文件位置:** +- macOS:`~/Library/Application Support/Google/Chrome/Default` +- Linux:`~/.config/google-chrome/Default`
-💬 Click to expand: Example queries you can try +💬 点击展开:可尝试的示例查询 -Once the index is built, you can ask questions like: +索引构建完成后,你可以提出如下问题: - "What websites did I visit about machine learning?" - "Find my search history about programming" @@ -594,7 +600,7 @@ Once the index is built, you can ask questions like:
-### 💬 WeChat Detective: Unlock Your Golden Memories! +### 💬 微信侦探:解锁你的珍贵回忆!

LEANN WeChat Search Demo @@ -603,27 +609,27 @@ Once the index is built, you can ask questions like: ```bash python -m apps.wechat_rag --query "Show me all group chats about weekend plans" ``` -**400K messages → 64MB storage** Search years of chat history in any language. +**400K 条消息 → 64MB 存储空间** 用任意语言搜索多年的聊天记录。

-🔧 Click to expand: Installation Requirements +🔧 点击展开:安装要求 -First, you need to install the [WeChat exporter](https://github.com/sunnyyoung/WeChatTweak-CLI), +首先,你需要安装 [WeChat exporter](https://github.com/sunnyyoung/WeChatTweak-CLI), ```bash brew install sunnyyoung/repo/wechattweak-cli ``` -or install it manually (if you have issues with Homebrew): +或手动安装(如果你在使用 Homebrew 时遇到问题): ```bash sudo packages/wechat-exporter/wechattweak-cli install ``` -**Troubleshooting:** -- **Installation issues**: Check the [WeChatTweak-CLI issues page](https://github.com/sunnyyoung/WeChatTweak-CLI/issues/41) -- **Export errors**: If you encounter the error below, try restarting WeChat +**故障排除:** +- **安装问题**:请查看 [WeChatTweak-CLI issues page](https://github.com/sunnyyoung/WeChatTweak-CLI/issues/41) +- **导出错误**:如果遇到以下错误,请尝试重启微信 ```bash Failed to export WeChat data. Please ensure WeChat is running and WeChatTweak is installed. Failed to find or export WeChat data. Exiting. @@ -631,15 +637,15 @@ sudo packages/wechat-exporter/wechattweak-cli install
-📋 Click to expand: WeChat-Specific Arguments +📋 点击展开:微信专用参数 -#### Parameters +#### 参数 ```bash --export-dir DIR # Directory to store exported WeChat data (default: wechat_export_direct) --force-export # Force re-export even if data exists ``` -#### Example Commands +#### 示例命令 ```bash # Search for travel plans discussed in group chats python -m apps.wechat_rag --query "travel plans" --max-items 10000 @@ -651,48 +657,48 @@ python -m apps.wechat_rag --force-export --query "work schedule"
-💬 Click to expand: Example queries you can try +💬 点击展开:你可以尝试的示例查询 -Once the index is built, you can ask questions like: +索引构建完成后,你可以提出类似这样的问题: -- "我想买魔术师约翰逊的球衣,给我一些对应聊天记录?" (Chinese: Show me chat records about buying Magic Johnson's jersey) +- "我想买魔术师约翰逊的球衣,给我一些对应聊天记录?" (中文:Show me chat records about buying Magic Johnson's jersey)
-### 🤖 ChatGPT Chat History: Your Personal AI Conversation Archive! +### 🤖 ChatGPT 聊天记录:你的个人 AI 对话档案库! -Transform your ChatGPT conversations into a searchable knowledge base! Search through all your ChatGPT discussions about coding, research, brainstorming, and more. +将你的 ChatGPT 对话转化为可搜索的知识库!检索你所有关于编程、研究、头脑风暴等内容的 ChatGPT 讨论。 ```bash python -m apps.chatgpt_rag --export-path chatgpt_export.html --query "How do I create a list in Python?" ``` -**Unlock your AI conversation history.** Never lose track of valuable insights from your ChatGPT discussions again. +**解锁你的 AI 对话历史。** 再也不会从 ChatGPT 讨论中丢失有价值的洞见。
-📋 Click to expand: How to Export ChatGPT Data +📋 点击展开:如何导出 ChatGPT 数据 -**Step-by-step export process:** +**分步导出流程:** -1. **Sign in to ChatGPT** -2. **Click your profile icon** in the top right corner -3. **Navigate to Settings** → **Data Controls** -4. **Click "Export"** under Export Data -5. **Confirm the export** request -6. **Download the ZIP file** from the email link (expires in 24 hours) -7. **Extract or use directly** with LEANN +1. **登录 ChatGPT** +2. 点击右上角的 **个人资料图标** +3. **进入 Settings(设置)** → **Data Controls(数据控制)** +4. 在 Export Data(导出数据)下 **点击 "Export"(导出)** +5. **确认导出** 请求 +6. 通过邮件中的链接 **下载 ZIP 文件**(24 小时内有效) +7. **解压或直接使用** LEANN 处理 -**Supported formats:** -- `.html` files from ChatGPT exports -- `.zip` archives from ChatGPT -- Directories with multiple export files +**支持的格式:** +- 来自 ChatGPT 导出的 `.html` 文件 +- 来自 ChatGPT 的 `.zip` 压缩包 +- 包含多个导出文件的目录
-📋 Click to expand: ChatGPT-Specific Arguments +📋 点击展开:ChatGPT 专用参数 -#### Parameters +#### 参数 ```bash --export-path PATH # Path to ChatGPT export file (.html/.zip) or directory (default: ./chatgpt_export) --separate-messages # Process each message separately instead of concatenated conversations @@ -700,7 +706,7 @@ python -m apps.chatgpt_rag --export-path chatgpt_export.html --query "How do I c --chunk-overlap N # Overlap between chunks (default: 128) ``` -#### Example Commands +#### 示例命令 ```bash # Basic usage with HTML export python -m apps.chatgpt_rag --export-path conversations.html @@ -721,9 +727,9 @@ python -m apps.chatgpt_rag --export-path ./chatgpt_exports/ --max-items 1000
-💡 Click to expand: Example queries you can try +💡 点击展开:你可以尝试的示例查询 -Once your ChatGPT conversations are indexed, you can search with queries like: +ChatGPT 对话完成索引后,你可以用类似这样的查询进行搜索: - "What did I ask ChatGPT about Python programming?" - "Show me conversations about machine learning algorithms" - "Find discussions about web development frameworks" @@ -733,40 +739,40 @@ Once your ChatGPT conversations are indexed, you can search with queries like:
-### 🤖 Claude Chat History: Your Personal AI Conversation Archive! +### 🤖 Claude 聊天记录:你的个人 AI 对话档案库! -Transform your Claude conversations into a searchable knowledge base! Search through all your Claude discussions about coding, research, brainstorming, and more. +将你的 Claude 对话转化为可搜索的知识库!检索你所有关于编程、研究、头脑风暴等内容的 Claude 讨论。 ```bash python -m apps.claude_rag --export-path claude_export.json --query "What did I ask about Python dictionaries?" ``` -**Unlock your AI conversation history.** Never lose track of valuable insights from your Claude discussions again. +**解锁你的 AI 对话历史。** 再也不会从 Claude 讨论中丢失有价值的洞见。
-📋 Click to expand: How to Export Claude Data +📋 点击展开:如何导出 Claude 数据 -**Step-by-step export process:** +**分步导出流程:** -1. **Open Claude** in your browser -2. **Navigate to Settings** (look for gear icon or settings menu) -3. **Find Export/Download** options in your account settings -4. **Download conversation data** (usually in JSON format) -5. **Place the file** in your project directory +1. 在浏览器中 **打开 Claude** +2. **进入 Settings(设置)**(查找齿轮图标或设置菜单) +3. 在账户设置中 **找到 Export/Download(导出/下载)** 选项 +4. **下载对话数据**(通常为 JSON 格式) +5. 将文件 **放到你的项目目录** -*Note: Claude export methods may vary depending on the interface you're using. Check Claude's help documentation for the most current export instructions.* +*注意:Claude 的导出方式可能因你使用的界面而异。请查阅 Claude 的帮助文档以获取最新的导出说明。* -**Supported formats:** -- `.json` files (recommended) -- `.zip` archives containing JSON data -- Directories with multiple export files +**支持的格式:** +- `.json` 文件(推荐) +- 包含 JSON 数据的 `.zip` 压缩包 +- 包含多个导出文件的目录
-📋 Click to expand: Claude-Specific Arguments +📋 点击展开:Claude 专用参数 -#### Parameters +#### 参数 ```bash --export-path PATH # Path to Claude export file (.json/.zip) or directory (default: ./claude_export) --separate-messages # Process each message separately instead of concatenated conversations @@ -774,7 +780,7 @@ python -m apps.claude_rag --export-path claude_export.json --query "What did I a --chunk-overlap N # Overlap between chunks (default: 128) ``` -#### Example Commands +#### 示例命令 ```bash # Basic usage with JSON export python -m apps.claude_rag --export-path my_claude_conversations.json @@ -795,9 +801,9 @@ python -m apps.claude_rag --export-path ./claude_exports/ --max-items 1000
-💡 Click to expand: Example queries you can try +💡 点击展开:你可以尝试的示例查询 -Once your Claude conversations are indexed, you can search with queries like: +Claude 对话完成索引后,你可以用类似这样的查询进行搜索: - "What did I ask Claude about Python programming?" - "Show me conversations about machine learning algorithms" - "Find discussions about software architecture patterns" @@ -807,49 +813,49 @@ Once your Claude conversations are indexed, you can search with queries like:
-### 💬 iMessage History: Your Personal Conversation Archive! +### 💬 iMessage 记录:你的个人对话档案库! -Transform your iMessage conversations into a searchable knowledge base! Search through all your text messages, group chats, and conversations with friends, family, and colleagues. +将你的 iMessage 对话转化为可搜索的知识库!检索你与朋友、家人和同事的所有短信、群聊和对话。 ```bash python -m apps.imessage_rag --query "What did we discuss about the weekend plans?" ``` -**Unlock your message history.** Never lose track of important conversations, shared links, or memorable moments from your iMessage history. +**解锁你的消息历史。** 再也不会从 iMessage 历史中丢失重要对话、分享的链接或难忘时刻。
-📋 Click to expand: How to Access iMessage Data +📋 点击展开:如何访问 iMessage 数据 -**iMessage data location:** +**iMessage 数据位置:** -iMessage conversations are stored in a SQLite database on your Mac at: +iMessage 对话存储在 Mac 上的 SQLite 数据库中,路径为: ``` ~/Library/Messages/chat.db ``` -**Important setup requirements:** +**重要的设置要求:** -1. **Grant Full Disk Access** to your terminal or IDE: - - Open **System Preferences** → **Security & Privacy** → **Privacy** - - Select **Full Disk Access** from the left sidebar - - Click the **+** button and add your terminal app (Terminal, iTerm2) or IDE (VS Code, etc.) - - Restart your terminal/IDE after granting access +1. **向终端或 IDE 授予完全磁盘访问权限(Full Disk Access)**: + - 打开 **System Preferences(系统偏好设置)** → **Security & Privacy(安全性与隐私)** → **Privacy(隐私)** + - 在左侧边栏选择 **Full Disk Access(完全磁盘访问权限)** + - 点击 **+** 按钮,添加你的终端应用(Terminal、iTerm2)或 IDE(VS Code 等) + - 授权后重启终端/IDE -2. **Alternative: Use a backup database** - - If you have Time Machine backups or manual copies of the database - - Use `--db-path` to specify a custom location +2. **备选方案:使用备份数据库** + - 如果你有 Time Machine 备份或数据库的手动副本 + - 使用 `--db-path` 指定自定义位置 -**Supported formats:** -- Direct access to `~/Library/Messages/chat.db` (default) -- Custom database path with `--db-path` -- Works with backup copies of the database +**支持的格式:** +- 直接访问 `~/Library/Messages/chat.db`(默认) +- 通过 `--db-path` 指定自定义数据库路径 +- 可配合数据库备份副本使用
-📋 Click to expand: iMessage-Specific Arguments +📋 点击展开:iMessage 专用参数 -#### Parameters +#### 参数 ```bash --db-path PATH # Path to chat.db file (default: ~/Library/Messages/chat.db) --concatenate-conversations # Group messages by conversation (default: True) @@ -858,7 +864,7 @@ iMessage conversations are stored in a SQLite database on your Mac at: --chunk-overlap N # Overlap between chunks (default: 200) ``` -#### Example Commands +#### 示例命令 ```bash # Basic usage (requires Full Disk Access) python -m apps.imessage_rag @@ -879,31 +885,31 @@ python -m apps.imessage_rag --max-items 100 --query "weekend"
-💡 Click to expand: Example queries you can try +💡 点击展开:可尝试的示例查询 -Once your iMessage conversations are indexed, you can search with queries like: -- "What did we discuss about vacation plans?" -- "Find messages about restaurant recommendations" -- "Show me conversations with John about the project" -- "Search for shared links about technology" -- "Find group chat discussions about weekend events" -- "What did mom say about the family gathering?" +当你的 iMessage 对话完成索引后,可以使用如下查询进行搜索: +- "我们关于度假计划讨论了什么?" +- "查找关于餐厅推荐的消息" +- "显示我与 John 关于该项目的对话" +- "搜索关于技术的分享链接" +- "查找群聊中关于周末活动的讨论" +- "妈妈关于家庭聚会说了什么?"
-### MCP Integration: RAG on Live Data from Any Platform +### MCP 集成:基于任意平台实时数据的 RAG -Connect to live data sources through the Model Context Protocol (MCP). LEANN now supports real-time RAG on platforms like Slack, Twitter, and more through standardized MCP servers. +通过 Model Context Protocol(MCP)连接实时数据源。LEANN 现已支持通过标准化 MCP 服务器,在 Slack、Twitter 等平台上进行实时 RAG(Retrieval-Augmented Generation,检索增强生成)。 -**Key Benefits:** -- **Live Data Access**: Fetch real-time data without manual exports -- **Standardized Protocol**: Use any MCP-compatible server -- **Easy Extension**: Add new platforms with minimal code -- **Secure Access**: MCP servers handle authentication +**主要优势:** +- **实时数据访问**:无需手动导出即可获取实时数据 +- **标准化协议**:可使用任意兼容 MCP 的服务器 +- **易于扩展**:以最少代码即可添加新平台 +- **安全访问**:由 MCP 服务器处理身份验证 -#### 💬 Slack Messages: Search Your Team Conversations +#### 💬 Slack 消息:搜索团队对话 -Transform your Slack workspace into a searchable knowledge base! Find discussions, decisions, and shared knowledge across all your channels. +将你的 Slack 工作区转变为可搜索的知识库!在所有频道中查找讨论、决策和共享知识。 ```bash # Test MCP server connection @@ -917,30 +923,30 @@ python -m apps.slack_rag \ --query "What did we decide about the product launch?" ``` -**📖 Comprehensive Setup Guide**: For detailed setup instructions, troubleshooting common issues (like "users cache is not ready yet"), and advanced configuration options, see our [**Slack Setup Guide**](docs/slack-setup-guide.md). +**📖 完整设置指南**:有关详细设置说明、常见问题排查(如 "users cache is not ready yet")以及高级配置选项,请参阅我们的 [**Slack 设置指南**](docs/slack-setup-guide.md)。 -**Quick Setup:** -1. Install a Slack MCP server (e.g., `npm install -g slack-mcp-server`) -2. Create a Slack App and get API credentials (see detailed guide above) -3. Set environment variables: +**快速设置:** +1. 安装 Slack MCP 服务器(例如 `npm install -g slack-mcp-server`) +2. 创建 Slack 应用并获取 API 凭据(参见上方详细指南) +3. 设置环境变量: ```bash export SLACK_BOT_TOKEN="xoxb-your-bot-token" export SLACK_APP_TOKEN="xapp-your-app-token" # Optional ``` -4. Test connection with `--test-connection` flag +4. 使用 `--test-connection` 标志测试连接 -**Arguments:** -- `--mcp-server`: Command to start the Slack MCP server -- `--workspace-name`: Slack workspace name for organization -- `--channels`: Specific channels to index (optional) -- `--concatenate-conversations`: Group messages by channel (default: true) -- `--max-messages-per-channel`: Limit messages per channel (default: 100) -- `--max-retries`: Maximum retries for cache sync issues (default: 5) -- `--retry-delay`: Initial delay between retries in seconds (default: 2.0) +**参数:** +- `--mcp-server`:启动 Slack MCP 服务器的命令 +- `--workspace-name`:用于组织的 Slack 工作区名称 +- `--channels`:要索引的特定频道(可选) +- `--concatenate-conversations`:按频道分组消息(默认:true) +- `--max-messages-per-channel`:每个频道的消息数量限制(默认:100) +- `--max-retries`:缓存同步问题的最大重试次数(默认:5) +- `--retry-delay`:重试之间的初始延迟(秒)(默认:2.0) -#### 🐦 Twitter Bookmarks: Your Personal Tweet Library +#### 🐦 Twitter 书签:你的个人推文库 -Search through your Twitter bookmarks! Find that perfect article, thread, or insight you saved for later. +搜索你的 Twitter 书签!找到你保存以备后用的那篇完美文章、推文串或见解。 ```bash # Test MCP server connection @@ -953,49 +959,49 @@ python -m apps.twitter_rag \ --query "What AI articles did I bookmark about machine learning?" ``` -**Setup Requirements:** -1. Install a Twitter MCP server (e.g., `npm install -g twitter-mcp-server`) -2. Get Twitter API credentials: - - Apply for a Twitter Developer Account at [developer.twitter.com](https://developer.twitter.com) - - Create a new app in the Twitter Developer Portal - - Generate API keys and access tokens with "Read" permissions - - For bookmarks access, you may need Twitter API v2 with appropriate scopes +**设置要求:** +1. 安装 Twitter MCP 服务器(例如 `npm install -g twitter-mcp-server`) +2. 获取 Twitter API 凭据: + - 在 [developer.twitter.com](https://developer.twitter.com) 申请 Twitter 开发者账号 + - 在 Twitter Developer Portal 中创建新应用 + - 生成具有 "Read" 权限的 API 密钥和访问令牌 + - 要访问书签,你可能需要具备相应权限范围的 Twitter API v2 ```bash export TWITTER_API_KEY="your-api-key" export TWITTER_API_SECRET="your-api-secret" export TWITTER_ACCESS_TOKEN="your-access-token" export TWITTER_ACCESS_TOKEN_SECRET="your-access-token-secret" ``` -3. Test connection with `--test-connection` flag +3. 使用 `--test-connection` 标志测试连接 -**Arguments:** -- `--mcp-server`: Command to start the Twitter MCP server -- `--username`: Filter bookmarks by username (optional) -- `--max-bookmarks`: Maximum bookmarks to fetch (default: 1000) -- `--no-tweet-content`: Exclude tweet content, only metadata -- `--no-metadata`: Exclude engagement metadata +**参数:** +- `--mcp-server`:启动 Twitter MCP 服务器的命令 +- `--username`:按用户名筛选书签(可选) +- `--max-bookmarks`:获取书签的最大数量(默认:1000) +- `--no-tweet-content`:排除推文内容,仅保留元数据 +- `--no-metadata`:排除互动元数据
-💡 Click to expand: Example queries you can try +💡 点击展开:可尝试的示例查询 -**Slack Queries:** -- "What did the team discuss about the project deadline?" -- "Find messages about the new feature launch" -- "Show me conversations about budget planning" -- "What decisions were made in the dev-team channel?" +**Slack 查询:** +- "团队关于项目截止日期讨论了什么?" +- "查找关于新功能发布的消息" +- "显示关于预算规划的对话" +- "dev-team 频道中做出了哪些决策?" -**Twitter Queries:** -- "What AI articles did I bookmark last month?" -- "Find tweets about machine learning techniques" -- "Show me bookmarked threads about startup advice" -- "What Python tutorials did I save?" +**Twitter 查询:** +- "我上个月收藏了哪些 AI 文章?" +- "查找关于机器学习技术的推文" +- "显示我收藏的关于创业建议的推文串" +- "我保存了哪些 Python 教程?"
-🔧 Using MCP with CLI Commands +🔧 在 CLI 命令中使用 MCP -**Want to use MCP data with regular LEANN CLI?** You can combine MCP apps with CLI commands: +**想在常规 LEANN CLI 中使用 MCP 数据?** 你可以将 MCP 应用与 CLI 命令结合使用: ```bash # Step 1: Use MCP app to fetch and index data @@ -1010,49 +1016,49 @@ python -m apps.twitter_rag --mcp-server "twitter-mcp-server" leann search twitter_bookmarks "machine learning articles" ``` -**MCP vs Manual Export:** -- **MCP**: Live data, automatic updates, requires server setup -- **Manual Export**: One-time setup, works offline, requires manual data export +**MCP 与手动导出对比:** +- **MCP**:实时数据、自动更新,需要服务器设置 +- **手动导出**:一次性设置、可离线使用,需要手动导出数据
-🔧 Adding New MCP Platforms +🔧 添加新的 MCP 平台 -Want to add support for other platforms? LEANN's MCP integration is designed for easy extension: +想为其他平台添加支持?LEANN 的 MCP 集成专为易于扩展而设计: -1. **Find or create an MCP server** for your platform -2. **Create a reader class** following the pattern in `apps/slack_data/slack_mcp_reader.py` -3. **Create a RAG application** following the pattern in `apps/slack_rag.py` -4. **Test and contribute** back to the community! +1. **查找或创建**适用于你平台的 MCP 服务器 +2. **创建 reader 类**,遵循 `apps/slack_data/slack_mcp_reader.py` 中的模式 +3. **创建 RAG 应用**,遵循 `apps/slack_rag.py` 中的模式 +4. **测试并回馈**社区! -**Popular MCP servers to explore:** -- GitHub repositories and issues -- Discord messages -- Notion pages -- Google Drive documents -- And many more in the MCP ecosystem! +**值得探索的热门 MCP 服务器:** +- GitHub 仓库与 issue +- Discord 消息 +- Notion 页面 +- Google Drive 文档 +- MCP 生态系统中还有更多!
-### 🚀 Claude Code Integration: Transform Your Development Workflow! +### 🚀 Claude Code 集成:改变你的开发工作流!
-AST‑Aware Code Chunking +AST 感知代码分块 -LEANN features intelligent code chunking that preserves semantic boundaries (functions, classes, methods) for Python, Java, C#, and TypeScript, improving code understanding compared to text-based chunking. +LEANN 提供智能代码分块功能,可为 Python、Java、C# 和 TypeScript 保留语义边界(函数、类、方法),相比基于文本的分块能更好地理解代码。 -📖 Read the [AST Chunking Guide →](docs/ast_chunking_guide.md) +📖 阅读 [AST 分块指南 →](docs/ast_chunking_guide.md)
-**The future of code assistance is here.** Transform your development workflow with LEANN's native MCP integration for Claude Code. Index your entire codebase and get intelligent code assistance directly in your IDE. +**代码辅助的未来已来。** 通过 LEANN 面向 Claude Code 的原生 MCP 集成,改变你的开发工作流。索引整个代码库,并在 IDE 中直接获得智能代码辅助。 -**Key features:** -- 🔍 **Semantic code search** across your entire project, fully local index and lightweight -- 🧠 **AST-aware chunking** preserves code structure (functions, classes) -- 📚 **Context-aware assistance** for debugging and development -- 🚀 **Zero-config setup** with automatic language detection +**主要特性:** +- 🔍 **语义代码搜索**:覆盖整个项目,完全本地索引且轻量 +- 🧠 **AST 感知分块**:保留代码结构(函数、类) +- 📚 **上下文感知辅助**:用于调试与开发 +- 🚀 **零配置设置**:自动语言检测 ```bash # Install LEANN globally for MCP integration @@ -1060,25 +1066,25 @@ uv tool install leann-core --with leann claude mcp add --scope user leann-server -- leann_mcp # Setup is automatic - just start using Claude Code! ``` -Try our fully agentic pipeline with auto query rewriting, semantic search planning, and more: +试用我们完整的智能体流水线,支持自动查询重写、语义搜索规划等功能: ![LEANN MCP Integration](assets/mcp_leann.png) -**🔥 Ready to supercharge your coding?** [Complete Setup Guide →](packages/leann-mcp/README.md) +**🔥 准备好大幅提升你的编码效率了吗?** [完整设置指南 →](packages/leann-mcp/README.md) -## Command Line Interface +## 命令行界面 -LEANN includes a powerful CLI for document processing and search. Perfect for quick document indexing and interactive chat. +LEANN 包含功能强大的 CLI,用于文档处理与搜索。非常适合快速文档索引和交互式对话。 -### Installation +### 安装 -If you followed the Quick Start, `leann` is already installed in your virtual environment: +如果你已按照快速入门操作,`leann` 已安装在你的虚拟环境中: ```bash source .venv/bin/activate leann --help ``` -**To make it globally available:** +**要使其全局可用:** ```bash # Install the LEANN CLI globally using uv tool uv tool install leann-core --with leann @@ -1088,11 +1094,11 @@ uv tool install leann-core --with leann leann --help ``` -> **Note**: Global installation is required for Claude Code integration. The `leann_mcp` server depends on the globally available `leann` command. +> **注意**:与 Claude Code 集成需要全局安装。`leann_mcp` 服务器依赖于全局可用的 `leann` 命令。 -### Usage Examples +### 使用示例 ```bash # build from a specific directory, and my_docs is the index name(Here you can also build from multiple dict or multiple files) @@ -1117,21 +1123,21 @@ leann list leann remove my-docs ``` -**Key CLI features:** -- Auto-detects document formats (PDF, TXT, MD, DOCX, PPTX + code files) -- **🧠 AST-aware chunking** for Python, Java, C#, TypeScript files -- Smart text chunking with overlap for all other content -- **📂 File change detection** via Merkle tree snapshots (`leann watch`) -- Multiple LLM providers (Ollama, OpenAI, HuggingFace) -- Organized index storage in `.leann/indexes/` (project-local) -- Support for advanced search parameters +**主要 CLI 功能:** +- 自动检测文档格式(PDF、TXT、MD、DOCX、PPTX 及代码文件) +- 针对 Python、Java、C#、TypeScript 文件的 **🧠 基于 AST 的分块(AST-aware chunking)** +- 对其他所有内容采用带重叠的智能文本分块 +- 通过 Merkle 树快照实现 **📂 文件变更检测**(`leann watch`) +- 支持多种 LLM 提供商(Ollama、OpenAI、HuggingFace) +- 在 `.leann/indexes/` 中进行有序的索引存储(项目本地) +- 支持高级搜索参数
-📋 Click to expand: Complete CLI Reference +📋 点击展开:完整 CLI 参考 -You can use `leann --help`, or `leann build --help`, `leann search --help`, `leann watch --help`, `leann ask --help`, `leann list --help`, `leann remove --help` to get the complete CLI reference. +你可以使用 `leann --help`,或 `leann build --help`、`leann search --help`、`leann watch --help`、`leann ask --help`、`leann list --help`、`leann remove --help` 获取完整的 CLI 参考。 -**Build Command:** +**构建命令:** ```bash leann build INDEX_NAME --docs DIRECTORY|FILE [DIRECTORY|FILE ...] [OPTIONS] @@ -1145,7 +1151,7 @@ Options: --recompute / --no-recompute Enable recomputation (default: true) ``` -**Search Command:** +**搜索命令:** ```bash leann search INDEX_NAME QUERY [OPTIONS] @@ -1156,7 +1162,7 @@ Options: --pruning-strategy {global,local,proportional} ``` -**Watch Command:** +**监视命令:** ```bash leann watch INDEX_NAME @@ -1174,7 +1180,7 @@ leann watch INDEX_NAME # chunks: 42, 43, 44 ``` -**Ask Command:** +**提问命令:** ```bash leann ask INDEX_NAME [OPTIONS] @@ -1185,7 +1191,7 @@ Options: --top-k N Retrieval count (default: 20) ``` -**List Command:** +**列表命令:** ```bash leann list @@ -1196,7 +1202,7 @@ leann list # 📄 - App-created index (*.leann.meta.json files) ``` -**Remove Command:** +**删除命令:** ```bash leann remove INDEX_NAME [OPTIONS] @@ -1212,11 +1218,11 @@ Options:
-## 🚀 Advanced Features +## 🚀 高级功能 -### 🎯 Metadata Filtering +### 🎯 元数据过滤 -LEANN supports a simple metadata filtering system to enable sophisticated use cases like document filtering by date/type, code search by file extension, and content management based on custom criteria. +LEANN 提供简单的元数据过滤系统,支持按日期/类型筛选文档、按文件扩展名搜索代码,以及基于自定义条件的内容管理等高级用例。 ```python # Add metadata during indexing @@ -1235,68 +1241,68 @@ results = searcher.search( ) ``` -**Supported operators**: `==`, `!=`, `<`, `<=`, `>`, `>=`, `in`, `not_in`, `contains`, `starts_with`, `ends_with`, `is_true`, `is_false` +**支持的运算符**:`==`、`!=`、`<`、`<=`、`>`、`>=`、`in`、`not_in`、`contains`、`starts_with`、`ends_with`、`is_true`、`is_false` -📖 **[Complete Metadata filtering guide →](docs/metadata_filtering.md)** +📖 **[完整元数据过滤指南 →](docs/metadata_filtering.md)** -### 🔍 Grep Search +### 🔍 Grep 搜索 -For exact text matching instead of semantic search, use the `use_grep` parameter: +如需精确文本匹配而非语义搜索,请使用 `use_grep` 参数: ```python # Exact text search results = searcher.search("banana‑crocodile", use_grep=True, top_k=1) ``` -**Use cases**: Finding specific code patterns, error messages, function names, or exact phrases where semantic similarity isn't needed. +**用例**:查找特定代码模式、错误消息、函数名或精确短语,无需语义相似度。 -📖 **[Complete grep search guide →](docs/grep_search.md)** +📖 **[完整 grep 搜索指南 →](docs/grep_search.md)** -## 🏗️ Architecture & How It Works +## 🏗️ 架构与工作原理

LEANN Architecture

-**The magic:** Most vector DBs store every single embedding (expensive). LEANN stores a pruned graph structure (cheap) and recomputes embeddings only when needed (fast). +**精髓所在:** 大多数向量数据库会存储每一个嵌入向量(成本高)。LEANN 存储经过剪枝的图结构(成本低),并仅在需要时重新计算嵌入向量(速度快)。 -**Core techniques:** -- **Graph-based selective recomputation:** Only compute embeddings for nodes in the search path -- **High-degree preserving pruning:** Keep important "hub" nodes while removing redundant connections -- **Dynamic batching:** Efficiently batch embedding computations for GPU utilization -- **Two-level search:** Smart graph traversal that prioritizes promising nodes +**核心技术:** +- **基于图的选择性重计算:** 仅为搜索路径中的节点计算嵌入向量 +- **高度保留剪枝:** 保留重要的「枢纽」节点,同时移除冗余连接 +- **动态批处理:** 高效批量计算嵌入向量以提升 GPU 利用率 +- **两级搜索:** 智能图遍历,优先探索有希望的节点 -**Backends:** -- **HNSW** (default): Ideal for most datasets with maximum storage savings through full recomputation -- **DiskANN**: Advanced option with superior search performance, using PQ-based graph traversal with real-time reranking for the best speed-accuracy trade-off +**后端:** +- **HNSW**(默认):适用于大多数数据集,通过完全重计算实现最大存储节省 +- **DiskANN**:高级选项,搜索性能更优,采用基于 PQ 的图遍历与实时重排序,在速度与精度之间取得最佳平衡 -## Benchmarks +## 基准测试 -**[DiskANN vs HNSW Performance Comparison →](benchmarks/diskann_vs_hnsw_speed_comparison.py)** - Compare search performance between both backends +**[DiskANN 与 HNSW 性能对比 →](benchmarks/diskann_vs_hnsw_speed_comparison.py)** - 对比两种后端的搜索性能 -**[Simple Example: Compare LEANN vs FAISS →](benchmarks/compare_faiss_vs_leann.py)** - See storage savings in action +**[简单示例:对比 LEANN 与 FAISS →](benchmarks/compare_faiss_vs_leann.py)** - 直观了解存储节省效果 -### 📊 Storage Comparison +### 📊 存储对比 -| System | DPR (2.1M) | Wiki (60M) | Chat (400K) | Email (780K) | Browser (38K) | +| 系统 | DPR (2.1M) | Wiki (60M) | Chat (400K) | Email (780K) | Browser (38K) | |--------|-------------|------------|-------------|--------------|---------------| -| Traditional vector database (e.g., FAISS) | 3.8 GB | 201 GB | 1.8 GB | 2.4 GB | 130 MB | +| 传统向量数据库(例如 FAISS) | 3.8 GB | 201 GB | 1.8 GB | 2.4 GB | 130 MB | | LEANN | 324 MB | 6 GB | 64 MB | 79 MB | 6.4 MB | -| Savings| 91% | 97% | 97% | 97% | 95% | +| 节省| 91% | 97% | 97% | 97% | 95% | -## Reproduce Our Results +## 复现我们的结果 ```bash uv run benchmarks/run_evaluation.py # Will auto-download evaluation data and run benchmarks uv run benchmarks/run_evaluation.py benchmarks/data/indices/rpj_wiki/rpj_wiki --num-queries 2000 # After downloading data, you can run the benchmark with our biggest index ``` -The evaluation script downloads data automatically on first run. The last three results were tested with partial personal data, and you can reproduce them with your own data! -## 🔬 Paper +评估脚本在首次运行时会自动下载数据。最后三项结果是使用部分个人数据测试的,你也可以使用自己的数据进行复现! +## 🔬 论文 -If you find Leann useful, please cite: +如果你觉得 Leann 有用,请引用: **[LEANN: A Low-Storage Vector Index](https://arxiv.org/abs/2506.08276)** @@ -1312,42 +1318,42 @@ If you find Leann useful, please cite: } ``` -## ✨ [Detailed Features →](docs/features.md) +## ✨ [详细功能 →](docs/features.md) -## 🤝 [CONTRIBUTING →](docs/CONTRIBUTING.md) +## 🤝 [贡献指南 →](docs/CONTRIBUTING.md) -## ❓ [FAQ →](docs/faq.md) +## ❓ [常见问题 →](docs/faq.md) -## 📈 [Roadmap →](docs/roadmap.md) +## 📈 [路线图 →](docs/roadmap.md) -## 📄 License +## 📄 许可证 -MIT License - see [LICENSE](LICENSE) for details. +MIT 许可证 — 详情请参阅 [LICENSE](LICENSE)。 -## 🙏 Acknowledgments +## 🙏 致谢 -Core Contributors: [Yichuan Wang](https://yichuan-w.github.io/) & [Zhifei Li](https://github.com/andylizf). +核心贡献者:[Yichuan Wang](https://yichuan-w.github.io/) & [Zhifei Li](https://github.com/andylizf). -Active Contributors: [Gabriel Dehan](https://github.com/gabriel-dehan), [Aakash Suresh](https://github.com/ASuresh0524) +活跃贡献者:[Gabriel Dehan](https://github.com/gabriel-dehan), [Aakash Suresh](https://github.com/ASuresh0524) -We welcome more contributors! Feel free to open issues or submit PRs. +欢迎更多贡献者参与!欢迎提交 Issue 或 PR。 -This work is done at [**Berkeley Sky Computing Lab**](https://sky.cs.berkeley.edu/). +本项工作在 [**Berkeley Sky Computing Lab**](https://sky.cs.berkeley.edu/). 完成 -## Star History +## Star 历史 [![Star History Chart](https://api.star-history.com/svg?repos=yichuan-w/LEANN&type=Date)](https://www.star-history.com/#yichuan-w/LEANN&Date)

- ⭐ Star us on GitHub if Leann is useful for your research or applications! + ⭐ 如果 Leann 对您的研究或应用有帮助,欢迎在 GitHub 上为我们标 Star!

- Made with ❤️ by the Leann team + 由 Leann 团队用 ❤️ 制作

-## 🤖 Explore LEANN with AI +## 🤖 用 AI 探索 LEANN -LEANN is indexed on [DeepWiki](https://deepwiki.com/yichuan-w/LEANN), so you can ask questions to LLMs using Deep Research to explore the codebase and get help to add new features. +LEANN 已收录于 [DeepWiki](https://deepwiki.com/yichuan-w/LEANN),,您可以通过 Deep Research 向 LLM 提问,探索代码库并获得添加新功能的帮助。