Skip to content

LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources。

TypeScript

docs: comprehensive README rewrite + Chinese translation

nash_sub535d3014901
diff --git a/README.md b/README.md
index 5d805b00..bef04838 100644
--- a/README.md
+++ b/README.md
@@ -17,6 +17,10 @@
<a href="#license">License</a>
</p>
+<p align="center">
+ English | <a href="README_CN.md">中文</a>
+</p>
+
---
## What is this?
@@ -44,120 +48,206 @@ The core architecture follows Karpathy's design faithfully:
## What We Changed & Added
-### Architecture Enhancements
+### 1. From CLI to Desktop Application
-| Original (Karpathy) | Our Implementation |
-|---------------------|-------------------|
-| CLI-based workflow (copy-paste to LLM agent) | Full desktop app (Tauri v2 + React) |
-| Single LLM conversation | Multi-conversation chat with history |
-| Manual ingest with discussion | Two-step chain-of-thought: LLM analyzes first, then generates |
-| Schema only | Schema + **Purpose.md** (wiki's soul — goals, key questions, scope) |
-| No search engine at small scale | **Tokenized search** with CJK bigram support + graph-enhanced retrieval |
-| index.md as sole navigation | **Knowledge View** (grouped by type) + File Tree + Graph View |
+The original is an abstract pattern document designed to be copy-pasted to an LLM agent. We built it into a **full cross-platform desktop application** with:
+- **Three-column layout**: Knowledge Tree / File Tree (left) + Chat (center) + Preview (right)
+- **Icon sidebar** for switching between Wiki, Sources, Search, Graph, Lint, Review, Deep Research, Settings
+- **Custom resizable panels** — drag-to-resize left and right panels with min/max constraints
+- **Activity panel** — real-time processing status showing file-by-file ingest progress
+- **All state persisted** — conversations, settings, review items, project config survive restarts
+- **Scenario templates** — Research, Reading, Personal Growth, Business, General — each pre-configures purpose.md and schema.md
-### Knowledge Graph & Relevance
+### 2. Purpose.md — The Wiki's Soul
-The original mentions Obsidian's graph view for browsing. We built a **full knowledge graph system**:
+The original has Schema (how the wiki works) but no formal place for **why** the wiki exists. We added `purpose.md`:
+- Defines goals, key questions, research scope, evolving thesis
+- LLM reads it during every ingest and query for context
+- LLM can suggest updates based on usage patterns
+- Different from schema — schema is structural rules, purpose is directional intent
-- **Interactive graph visualization** (sigma.js) with nodes colored by type
-- **4-signal relevance model** for relationship strength:
- - Direct links (wikilink count) × 3.0
- - Source overlap (shared source files) × 4.0
- - Common neighbors (Adamic-Adar) × 1.5
- - Type affinity (entity↔concept) × 1.0
-- **Edge thickness and color** reflect relationship strength
-- **Graph-enhanced retrieval**: Chat queries expand to related nodes via 1-level graph traversal
-- **Budget-controlled context**: 60% for pages, 20% for history, 5% for index, 15% reserved
+### 3. Two-Step Chain-of-Thought Ingest
-### Ingest Pipeline
-
-The original describes a single-step ingest. We use a **two-step chain-of-thought**:
+The original describes a single-step ingest where the LLM reads and writes simultaneously. We split it into **two sequential LLM calls** for significantly better quality:
```
Step 1 (Analysis): LLM reads source → structured analysis
- Key entities, concepts, arguments
- - Connections to existing wiki
- - Contradictions & tensions
- - Recommendations
+ - Connections to existing wiki content
+ - Contradictions & tensions with existing knowledge
+ - Recommendations for wiki structure
Step 2 (Generation): LLM takes analysis → generates wiki files
- - Source summary, entities, concepts
+ - Source summary with frontmatter (type, title, sources[])
+ - Entity pages, concept pages with cross-references
- Updated index.md, log.md, overview.md
- Review items for human judgment
- Search queries for Deep Research
```
-### Review System (Async Human-in-the-Loop)
+Additional ingest enhancements beyond the original:
+- **Source traceability** — every generated wiki page includes a `sources: []` field in YAML frontmatter, linking back to the raw source files that contributed to it
+- **overview.md auto-update** — global summary page regenerated on every ingest to reflect the latest state of the wiki
+- **Guaranteed source summary** — fallback ensures a source summary page is always created, even if the LLM omits it
+- **Language-aware generation** — LLM responds in the user's configured language (English or Chinese)
+
+### 4. Knowledge Graph with Relevance Model
+
+The original mentions `[[wikilinks]]` for cross-references but has no graph analysis. We built a **full knowledge graph visualization and relevance engine**:
+
+**4-Signal Relevance Model:**
+| Signal | Weight | Description |
+|--------|--------|-------------|
+| Direct link | ×3.0 | Pages linked via `[[wikilinks]]` |
+| Source overlap | ×4.0 | Pages sharing the same raw source (via frontmatter `sources[]`) |
+| Adamic-Adar | ×1.5 | Pages sharing common neighbors (weighted by neighbor degree) |
+| Type affinity | ×1.0 | Bonus for same page type (entity↔entity, concept↔concept) |
+
+**Graph Visualization (sigma.js + graphology + ForceAtlas2):**
+- Node colors by page type, sizes scaled by link count (√ scaling)
+- Edge thickness and color by relevance weight (green=strong, gray=weak)
+- Hover interaction: neighbors stay visible, non-neighbors dim, edges highlight with relevance score label
+- Zoom controls (ZoomIn, ZoomOut, Fit-to-screen)
+- Position caching prevents layout jumps when data updates
+- Legend showing node counts per type
+
+### 5. Optimized Query Retrieval Pipeline
+
+The original describes a simple query where the LLM reads relevant pages. We built a **4-phase retrieval pipeline** with budget control:
+
+```
+Phase 1: Tokenized Search
+ - English: word splitting + stop word removal
+ - Chinese: CJK bigram tokenization (每个 → [每个, 个…])
+ - Title match bonus (+10 score)
+ - Searches both wiki/ and raw/sources/
+
+Phase 2: Graph Expansion
+ - Top search results used as seed nodes
+ - 4-signal relevance model finds related pages
+ - Discovers connections the keyword search missed
+
+Phase 3: Budget Control
+ - Configurable context window: 4K → 1M tokens
+ - Proportional allocation: 60% wiki pages, 20% chat history, 5% index, 15% system
+ - Pages prioritized by combined search + graph relevance score
+
+Phase 4: Context Assembly
+ - Numbered pages with full content (not just summaries)
+ - System prompt includes: purpose.md, language rules, citation format, index.md
+ - LLM instructed to cite pages by number: [1], [2], etc.
+```
+
+### 6. Multi-Conversation Chat with Persistence
+
+The original has a single query interface. We built **full multi-conversation support**:
+
+- **Independent chat sessions** — create, rename, delete conversations
+- **Conversation sidebar** — quick switching between topics
+- **Per-conversation persistence** — each conversation saved to `.llm-wiki/chats/{id}.json`
+- **Configurable history depth** — limit how many messages are sent as context (default: 10)
+- **Cited references panel** — collapsible section on each response showing which wiki pages were used, grouped by type with icons
+- **Reference persistence** — cited pages stored directly in message data, stable across restarts
+- **Regenerate** — re-generate the last response with one click (removes last assistant + user message pair, re-sends)
+- **Save to Wiki** — archive valuable answers to `wiki/queries/`, then auto-ingest to extract entities/concepts into the knowledge network
+
+### 7. Thinking / Reasoning Display
+
+Not in the original. For LLMs that emit `<think>` blocks (DeepSeek, QwQ, etc.):
+
+- **Streaming thinking** — rolling 5-line display with opacity fade during generation
+- **Collapsed by default** — thinking blocks hidden after completion, click to expand
+- **Visual separation** — thinking content shown in distinct style, separate from the main response
+
+### 8. LaTeX → Unicode Conversion
+
+Not in the original. Handles mathematical notation across all views:
+
+- **100+ symbol mappings** — Greek letters (α, β, γ), operators (∑, ∏, ∫), arrows (→, ←, ↔), relations (≤, ≥, ≠), and more
+- **Inline conversion** — `$\alpha$` → α, `$\sum$` → ∑, rendered in chat, preview, and saved wiki pages
+
+### 9. Review System (Async Human-in-the-Loop)
The original suggests staying involved during ingest. We added an **asynchronous review queue**:
- LLM flags items needing human judgment during ingest
-- Contradictions, duplicates, missing pages, suggestions
-- Pre-made action buttons: Create Page, Deep Research, Skip
+- **Predefined action types**: Create Page, Deep Research, Skip — constrained to prevent LLM hallucination of arbitrary actions
+- **Search queries generated at ingest time** — LLM pre-generates optimized web search queries for each review item
- User handles reviews at their convenience — doesn't block ingest
-### Deep Research
+### 10. Deep Research
Not in the original. When the LLM identifies knowledge gaps:
- **Web search** (Tavily API) finds relevant sources
-- **Multiple search queries** per topic (LLM-generated, optimized for search engines)
-- **LLM synthesizes** findings into a wiki research page
-- **Auto-ingest** the research result to extract entities/concepts
+- **Multiple search queries** per topic — LLM-generated at ingest time, optimized for search engines
+- **LLM synthesizes** findings into a wiki research page with cross-references to existing wiki
+- **Auto-ingest** — research results automatically processed to extract entities/concepts into the wiki
- **Task queue** with 3 concurrent tasks
-- **Research Panel** shows real-time progress
+- **Research Panel** — dedicated sidebar panel showing real-time progress per task
-### Browser Extension (Web Clipper)
+### 11. Browser Extension (Web Clipper)
-The original mentions Obsidian Web Clipper. We built a **dedicated Chrome Extension**:
+The original mentions Obsidian Web Clipper. We built a **dedicated Chrome Extension** (Manifest V3):
-- **Mozilla Readability.js** for accurate article extraction
-- **Turndown.js** for HTML → Markdown conversion
-- **Project picker** — choose which wiki to clip into
-- **Local HTTP API** (port 19827) — Extension → App communication
-- **Auto-ingest** — clipped content automatically processed into wiki
-- Works even when app is not running (shows content preview)
+- **Mozilla Readability.js** for accurate article extraction (strips ads, nav, sidebars)
+- **Turndown.js** for HTML → Markdown conversion with table support
+- **Project picker** — choose which wiki to clip into (supports multi-project)
+- **Local HTTP API** (port 19827, tiny_http) — Extension ↔ App communication
+- **Auto-ingest** — clipped content automatically triggers the two-step ingest pipeline
+- **Clip watcher** — polls every 3 seconds for new clips, processes automatically
+- **Offline preview** — shows extracted content even when app is not running
-### Multi-format Document Support
+### 12. Multi-format Document Support
-The original focuses on text/markdown. We support:
+The original focuses on text/markdown. We support structured extraction preserving document semantics:
| Format | Method |
|--------|--------|
-| PDF | pdf-extract (Rust) |
-| DOCX | docx-rs — headings, bold/italic, lists, tables → Markdown |
-| PPTX | ZIP + XML — slide-by-slide extraction with structure |
-| XLSX/XLS/ODS | calamine — proper cell types, multi-sheet, Markdown tables |
+| PDF | pdf-extract (Rust) with file caching |
+| DOCX | docx-rs — headings, bold/italic, lists, tables → structured Markdown |
+| PPTX | ZIP + XML — slide-by-slide extraction with heading/list structure |
+| XLSX/XLS/ODS | calamine — proper cell types, multi-sheet support, Markdown tables |
| Images | Native preview (png, jpg, gif, webp, svg, etc.) |
| Video/Audio | Built-in player |
-| Web clips | Readability.js + Turndown.js → Markdown |
-
-### Chat Enhancements
-
-| Feature | Details |
-|---------|---------|
-| **Multi-conversation** | Independent chat sessions with history |
-| **Cited references** | Each response shows which wiki pages were used |
-| **Tokenized search** | Chinese bigram + English word splitting for retrieval |
-| **Graph expansion** | Retrieves related pages via knowledge graph |
-| **Budget control** | Configurable context window (4K → 1M), proportional allocation |
-| **Save to Wiki** | Archive valuable answers → auto-ingest into knowledge network |
-| **Regenerate** | Re-generate last response with one click |
-| **Thinking display** | `<think>` blocks shown as collapsible sections |
-| **LaTeX → Unicode** | 100+ symbols converted (→ α ∑ ≤ etc.) |
-| **Markdown tables** | GFM table rendering with borders |
-
-### Other Additions
-
-- **i18n** — English + Chinese interface
-- **Scenario templates** — Research, Reading, Personal Growth, Business, General
-- **Settings persistence** — LLM provider, context size, language saved across restarts
-- **Chat persistence** — Conversations saved per-project, survive restarts
-- **Activity panel** — Real-time ingest progress with file-by-file details
-- **Obsidian config** — Auto-generated `.obsidian/` with recommended settings
-- **File deletion cascade** — Deleting a source cleanly removes related wiki pages, updates index, cleans wikilinks
-- **Cross-platform** — macOS, Windows, Linux (path normalization throughout)
-- **GitHub Actions CI/CD** — Automated builds for all platforms
+| Web clips | Readability.js + Turndown.js → clean Markdown |
+
+### 13. File Deletion with Cascade Cleanup
+
+The original has no deletion mechanism. We added **intelligent cascade deletion**:
+
+- Deleting a source file removes its wiki summary page
+- **3-method matching** finds related wiki pages: frontmatter `sources[]` field, source summary page name, frontmatter section references
+- **Shared entity preservation** — entity/concept pages linked to multiple sources only have the deleted source removed from their `sources[]` array, not deleted entirely
+- **Index cleanup** — removed pages are purged from index.md
+- **Wikilink cleanup** — dead `[[wikilinks]]` to deleted pages are removed from remaining wiki pages
+
+### 14. Configurable Context Window
+
+Not in the original. Users can configure how much context the LLM receives:
+
+- **Slider from 4K to 1M tokens** — adapts to different LLM capabilities
+- **Proportional budget allocation** — larger windows get proportionally more wiki content
+- **60/20/5/15 split** — wiki pages / chat history / index / system prompt
+
+### 15. Cross-Platform Compatibility
+
+The original is platform-agnostic (abstract pattern). We handle concrete cross-platform concerns:
+
+- **Path normalization** — unified `normalizePath()` used across 22+ files, backslash → forward slash
+- **Unicode-safe string handling** — char-based slicing instead of byte-based (prevents crashes on CJK filenames)
+- **Tauri v2** — native desktop on macOS, Windows, Linux
+- **GitHub Actions CI/CD** — automated builds for macOS (ARM + Intel), Windows (.msi), Linux (.deb / .AppImage)
+
+### 16. Other Additions
+
+- **i18n** — English + Chinese interface (react-i18next)
+- **Settings persistence** — LLM provider, API key, model, context size, language saved via Tauri Store
+- **Obsidian config** — auto-generated `.obsidian/` directory with recommended settings
+- **Markdown rendering** — GFM tables with borders, proper code blocks, wikilink processing in chat and preview
+- **Multi-provider LLM support** — OpenAI, Anthropic, Google, Ollama, Custom — each with provider-specific streaming and headers
+- **15-minute timeout** — long ingest operations won't fail prematurely
+- **dataVersion signaling** — graph and UI automatically refresh when wiki content changes
## Tech Stack
diff --git a/README_CN.md b/README_CN.md
new file mode 100644
index 00000000..f627d199
--- /dev/null
+++ b/README_CN.md
@@ -0,0 +1,332 @@
+# LLM Wiki
+
+<p align="center">
+ <img src="logo.jpg" width="128" height="128" style="border-radius: 22%;" alt="LLM Wiki Logo">
+</p>
+
+<p align="center">
+ <strong>一个能自我构建的个人知识库。</strong><br>
+ LLM 阅读你的文档,构建结构化 Wiki,并持续保持更新。
+</p>
+
+<p align="center">
+ <a href="#安装">安装</a> •
+ <a href="#功能特性">功能特性</a> •
+ <a href="#工作原理">工作原理</a> •
+ <a href="#致谢">致谢</a> •
+ <a href="#许可证">许可证</a>
+</p>
+
+<p align="center">
+ <a href="README.md">English</a> | 中文
+</p>
+
+---
+
+## 这是什么?
+
+LLM Wiki 是一个跨平台桌面应用,能将你的文档自动转化为有组织、相互关联的知识库。与传统 RAG(每次查询都从头检索和回答)不同,LLM 会从你的资料中**增量构建并维护一个持久化的 Wiki**。知识只编译一次并持续更新,而非每次查询都重新推导。
+
+本项目基于 [Karpathy 的 LLM Wiki 模式](https://github.com/karpathy/llm-wiki) —— 一套使用 LLM 构建个人知识库的方法论。我们将其核心理念实现为一个完整的桌面应用,并做了大量增强。
+
+## 致谢
+
+基础方法论来自 **Andrej Karpathy** 的 [llm-wiki.md](https://github.com/karpathy/llm-wiki),描述了使用 LLM 增量构建和维护个人 Wiki 的设计模式。原始文档是一个抽象的设计范式;本项目是一个具体的实现,并有大量扩展。
+
+## 保留的原始设计
+
+核心架构忠实遵循 Karpathy 的设计:
+
+- **三层架构**:原始资料(不可变)→ Wiki(LLM 生成)→ Schema(规则和配置)
+- **三个核心操作**:Ingest(摄入)、Query(查询)、Lint(检查)
+- **index.md** 作为内容目录和 LLM 导航入口
+- **log.md** 作为可解析格式的时序操作记录
+- **[[wikilink]]** 语法用于交叉引用
+- **YAML frontmatter** 存在于每个 Wiki 页面
+- **Obsidian 兼容** —— Wiki 目录可直接作为 Obsidian 仓库使用
+- **人类策展,LLM 维护** —— 基本角色分工
+
+## 我们的修改与新增
+
+### 1. 从命令行到桌面应用
+
+原始设计是一个抽象的模式文档,设计上是复制粘贴给 LLM agent 使用的。我们将其构建为**完整的跨平台桌面应用**:
+- **三栏布局**:知识树 / 文件树(左)+ 聊天(中)+ 预览(右)
+- **图标侧边栏** —— 在 Wiki、资料源、搜索、图谱、Lint、审核、深度研究、设置之间快速切换
+- **自定义可调面板** —— 左右面板支持拖拽调整大小,带最小/最大约束
+- **活动面板** —— 实时处理状态,逐文件显示摄入进度
+- **全状态持久化** —— 对话、设置、审核项、项目配置在重启后保持
+- **场景模板** —— 研究、阅读、个人成长、商业、通用 —— 每个模板预配置 purpose.md 和 schema.md
+
+### 2. Purpose.md —— Wiki 的灵魂
+
+原始设计有 Schema(Wiki 如何运作),但没有正式定义 **为什么** 这个 Wiki 存在。我们新增了 `purpose.md`:
+- 定义目标、关键问题、研究范围、演进中的论点
+- LLM 在每次摄入和查询时都会读取它以获取上下文
+- LLM 可以根据使用模式建议更新
+- 与 schema 不同 —— schema 是结构规则,purpose 是方向意图
+
+### 3. 两步思维链摄入
+
+原始设计描述的是 LLM 同时阅读和写入的单步摄入。我们将其拆分为**两次顺序 LLM 调用**,显著提升质量:
+
+```
+第一步(分析):LLM 阅读资料 → 结构化分析
+ - 关键实体、概念、论点
+ - 与现有 Wiki 内容的关联
+ - 与现有知识的矛盾和张力
+ - Wiki 结构建议
+
+第二步(生成):LLM 基于分析 → 生成 Wiki 文件
+ - 带 frontmatter 的资料摘要(type, title, sources[])
+ - 实体页面、概念页面及交叉引用
+ - 更新 index.md、log.md、overview.md
+ - 需要人工判断的审核项
+ - 深度研究的搜索查询
+```
+
+超越原始设计的摄入增强:
+- **来源可追溯** —— 每个生成的 Wiki 页面在 YAML frontmatter 中包含 `sources: []` 字段,链接回贡献的原始资料文件
+- **overview.md 自动更新** —— 全局概要页面在每次摄入后重新生成,反映 Wiki 最新状态
+- **保证资料摘要生成** —— 兜底机制确保资料摘要页面始终被创建,即使 LLM 遗漏
+- **语言感知生成** —— LLM 按用户配置的语言(中文或英文)响应
+
+### 4. 知识图谱与关联度模型
+
+原始设计提到了 `[[wikilinks]]` 用于交叉引用,但没有图分析。我们构建了**完整的知识图谱可视化和关联度引擎**:
+
+**四信号关联度模型:**
+| 信号 | 权重 | 描述 |
+|------|------|------|
+| 直接链接 | ×3.0 | 通过 `[[wikilinks]]` 链接的页面 |
+| 来源重叠 | ×4.0 | 共享同一原始资料的页面(通过 frontmatter `sources[]`) |
+| Adamic-Adar | ×1.5 | 共享共同邻居的页面(按邻居度数加权) |
+| 类型亲和 | ×1.0 | 相同页面类型的加分(实体↔实体,概念↔概念) |
+
+**图谱可视化(sigma.js + graphology + ForceAtlas2):**
+- 按页面类型着色节点,按链接数缩放节点大小(√ 缩放)
+- 边的粗细和颜色按关联权重变化(绿色=强,灰色=弱)
+- 悬停交互:邻居节点保持可见,非邻居变暗,边高亮并显示关联度分数
+- 缩放控件(放大、缩小、适应屏幕)
+- 位置缓存防止数据更新时布局跳动
+- 图例显示每种类型的节点计数
+
+### 5. 优化的查询检索管线
+
+原始设计描述了 LLM 读取相关页面的简单查询。我们构建了带预算控制的**四阶段检索管线**:
+
+```
+阶段 1:分词搜索
+ - 英文:分词 + 停用词过滤
+ - 中文:CJK 二元组分词(每个 → [每个, 个…])
+ - 标题匹配加分(+10 分)
+ - 同时搜索 wiki/ 和 raw/sources/
+
+阶段 2:图谱扩展
+ - 搜索结果作为种子节点
+ - 四信号关联度模型发现相关页面
+ - 发现关键词搜索遗漏的关联
+
+阶段 3:预算控制
+ - 可配置上下文窗口:4K → 1M tokens
+ - 比例分配:60% Wiki 页面,20% 聊天历史,5% 索引,15% 系统提示
+ - 页面按搜索 + 图谱关联度综合分数排序
+
+阶段 4:上下文组装
+ - 编号页面附完整内容(非仅摘要)
+ - 系统提示包含:purpose.md、语言规则、引用格式、index.md
+ - LLM 被指示按编号引用页面:[1]、[2] 等
+```
+
+### 6. 多对话聊天与持久化
+
+原始设计只有单一查询接口。我们构建了**完整的多对话支持**:
+
+- **独立聊天会话** —— 创建、重命名、删除对话
+- **对话侧边栏** —— 快速切换不同主题
+- **逐对话持久化** —— 每个对话保存到 `.llm-wiki/chats/{id}.json`
+- **可配置历史深度** —— 限制作为上下文发送的消息数量(默认:10)
+- **引用参考面板** —— 每条回复上可折叠的区域,显示使用了哪些 Wiki 页面,按类型分组并附图标
+- **引用持久化** —— 引用的页面直接存储在消息数据中,重启后稳定不变
+- **重新生成** —— 一键重新生成最后一条回复(移除最后的助手+用户消息对,重新发送)
+- **保存到 Wiki** —— 将有价值的回答归档到 `wiki/queries/`,然后自动摄入提取实体/概念到知识网络
+
+### 7. 思维链 / 推理过程展示
+
+原始设计中没有。针对会输出 `<think>` 块的 LLM(DeepSeek、QwQ 等):
+
+- **流式思维展示** —— 生成中滚动显示 5 行,带透明度渐变
+- **默认折叠** —— 生成完成后思维块隐藏,点击展开
+- **视觉分离** —— 思维内容以独特样式显示,与主回复分开
+
+### 8. LaTeX → Unicode 转换
+
+原始设计中没有。跨所有视图处理数学符号:
+
+- **100+ 符号映射** —— 希腊字母(α, β, γ)、运算符(∑, ∏, ∫)、箭头(→, ←, ↔)、关系符(≤, ≥, ≠)等
+- **内联转换** —— `$\alpha$` → α,`$\sum$` → ∑,在聊天、预览和保存的 Wiki 页面中渲染
+
+### 9. 审核系统(异步人机协作)
+
+原始设计建议在摄入时全程参与。我们新增了**异步审核队列**:
+
+- LLM 在摄入过程中标记需要人工判断的项目
+- **预定义操作类型**:创建页面、深度研究、跳过 —— 约束操作防止 LLM 凭空生成任意操作
+- **摄入时生成搜索查询** —— LLM 预先为每个审核项生成优化的网络搜索查询
+- 用户可在方便时处理审核 —— 不阻塞摄入流程
+
+### 10. 深度研究
+
+原始设计中没有。当 LLM 识别出知识空白时:
+
+- **网络搜索**(Tavily API)查找相关资料
+- **多条搜索查询** —— 摄入时由 LLM 生成,针对搜索引擎优化
+- **LLM 综合** 搜索结果生成 Wiki 研究页面,并交叉引用现有 Wiki
+- **自动摄入** —— 研究结果自动进入两步摄入流程,提取实体/概念到 Wiki
+- **任务队列** —— 最多 3 个并发任务
+- **研究面板** —— 专用侧边面板实时显示每个任务的进度
+
+### 11. 浏览器扩展(网页剪藏)
+
+原始设计提到了 Obsidian Web Clipper。我们构建了**专用 Chrome 扩展**(Manifest V3):
+
+- **Mozilla Readability.js** 精确提取文章内容(去除广告、导航、侧边栏)
+- **Turndown.js** 将 HTML 转换为 Markdown,支持表格
+- **项目选择器** —— 选择剪藏到哪个 Wiki(支持多项目)
+- **本地 HTTP API**(端口 19827,tiny_http)—— 扩展 ↔ 应用通信
+- **自动摄入** —— 剪藏内容自动触发两步摄入流程
+- **剪藏监听** —— 每 3 秒轮询新剪藏,自动处理
+- **离线预览** —— 即使应用未运行也能显示提取的内容
+
+### 12. 多格式文档支持
+
+原始设计聚焦于纯文本/Markdown。我们支持保留文档语义的结构化提取:
+
+| 格式 | 方法 |
+|------|------|
+| PDF | pdf-extract(Rust)+ 文件缓存 |
+| DOCX | docx-rs —— 标题、加粗/斜体、列表、表格 → 结构化 Markdown |
+| PPTX | ZIP + XML —— 逐页提取,保留标题/列表结构 |
+| XLSX/XLS/ODS | calamine —— 正确的单元格类型、多工作表支持、Markdown 表格 |
+| 图片 | 原生预览(png, jpg, gif, webp, svg 等) |
+| 视频/音频 | 内置播放器 |
+| 网页剪藏 | Readability.js + Turndown.js → 干净的 Markdown |
+
+### 13. 文件删除级联清理
+
+原始设计没有删除机制。我们新增了**智能级联删除**:
+
+- 删除资料文件时同时移除其 Wiki 摘要页面
+- **三重匹配** 查找相关 Wiki 页面:frontmatter `sources[]` 字段、资料摘要页面名称、frontmatter 章节引用
+- **共享实体保护** —— 链接到多个资料的实体/概念页面仅从其 `sources[]` 数组中移除被删除的资料,而非删除整个页面
+- **索引清理** —— 被移除的页面从 index.md 中清除
+- **Wiki 链接清理** —— 指向已删除页面的失效 `[[wikilinks]]` 从其余 Wiki 页面中移除
+
+### 14. 可配置上下文窗口
+
+原始设计中没有。用户可配置 LLM 接收多少上下文:
+
+- **4K 到 1M tokens 滑块** —— 适配不同 LLM 的能力
+- **比例预算分配** —— 更大的窗口按比例获得更多 Wiki 内容
+- **60/20/5/15 分配** —— Wiki 页面 / 聊天历史 / 索引 / 系统提示
+
+### 15. 跨平台兼容
+
+原始设计与平台无关(抽象模式)。我们处理了具体的跨平台问题:
+
+- **路径规范化** —— 统一的 `normalizePath()` 在 22+ 个文件中使用,反斜杠 → 正斜杠
+- **Unicode 安全字符串处理** —— 基于字符而非字节的切片(防止中文文件名导致崩溃)
+- **Tauri v2** —— macOS、Windows、Linux 原生桌面
+- **GitHub Actions CI/CD** —— 自动构建 macOS(ARM + Intel)、Windows(.msi)、Linux(.deb / .AppImage)
+
+### 16. 其他新增
+
+- **国际化** —— 中英文界面(react-i18next)
+- **设置持久化** —— LLM 提供商、API 密钥、模型、上下文大小、语言通过 Tauri Store 保存
+- **Obsidian 配置** —— 自动生成 `.obsidian/` 目录及推荐设置
+- **Markdown 渲染** —— 带边框的 GFM 表格、代码块、聊天和预览中的 wikilink 处理
+- **多 LLM 提供商** —— OpenAI、Anthropic、Google、Ollama、自定义 —— 各有特定的流式传输和请求头
+- **15 分钟超时** —— 长时间摄入操作不会过早失败
+- **dataVersion 信号** —— 图谱和 UI 在 Wiki 内容变更时自动刷新
+
+## 技术栈
+
+| 层级 | 技术 |
+|------|------|
+| 桌面 | Tauri v2(Rust 后端) |
+| 前端 | React 19 + TypeScript + Vite |
+| UI | shadcn/ui + Tailwind CSS v4 |
+| 编辑器 | Milkdown(基于 ProseMirror 的所见即所得) |
+| 图谱 | sigma.js + graphology + ForceAtlas2 |
+| 搜索 | 自定义分词搜索 + 图谱关联度 |
+| PDF | pdf-extract |
+| Office | docx-rs + calamine |
+| 国际化 | react-i18next |
+| 状态管理 | Zustand |
+| LLM | 流式 fetch(OpenAI、Anthropic、Google、Ollama、自定义) |
+| 网络搜索 | Tavily API |
+
+## 安装
+
+### 预编译二进制文件
+
+从 [Releases](https://github.com/nashsu/llm_wiki/releases) 下载:
+- **macOS**:`.dmg`(Apple Silicon + Intel)
+- **Windows**:`.msi`
+- **Linux**:`.deb` / `.AppImage`
+
+### 从源码构建
+
+```bash
+# 前置条件:Node.js 20+, Rust 1.70+
+git clone https://github.com/nashsu/llm_wiki.git
+cd llm_wiki
+npm install
+npm run tauri dev # 开发模式
+npm run tauri build # 生产构建
+```
+
+### Chrome 扩展
+
+1. 打开 `chrome://extensions`
+2. 启用「开发者模式」
+3. 点击「加载已解压的扩展程序」
+4. 选择 `extension/` 目录
+
+## 快速开始
+
+1. 启动应用 → 创建新项目(选择模板)
+2. 进入 **设置** → 配置 LLM 提供商(API 密钥 + 模型)
+3. 进入 **资料源** → 导入文档(PDF、DOCX、MD 等)
+4. 观察 **活动面板** —— LLM 自动构建 Wiki 页面
+5. 使用 **聊天** 查询你的知识库
+6. 浏览 **知识图谱** 查看关联
+7. 查看 **审核** 处理需要你关注的项目
+8. 定期运行 **Lint** 维护 Wiki 健康度
+
+## 项目结构
+
+```
+my-wiki/
+├── purpose.md # 目标、关键问题、研究范围
+├── schema.md # Wiki 结构规则、页面类型
+├── raw/
+│ ├── sources/ # 上传的文档(不可变)
+│ └── assets/ # 本地图片
+├── wiki/
+│ ├── index.md # 内容目录
+│ ├── log.md # 操作历史
+│ ├── overview.md # 全局概要(自动更新)
+│ ├── entities/ # 人物、组织、产品
+│ ├── concepts/ # 理论、方法、技术
+│ ├── sources/ # 资料摘要
+│ ├── queries/ # 保存的聊天回答 + 研究
+│ ├── synthesis/ # 跨资料分析
+│ └── comparisons/ # 并列对比
+├── .obsidian/ # Obsidian 仓库配置(自动生成)
+└── .llm-wiki/ # 应用配置、聊天历史、审核项
+```
+
+## 许可证
+
+本项目基于 **GNU 通用公共许可证 v3.0** 授权 —— 详见 [LICENSE](LICENSE)。