Soren-ABT/dsh-knowledge ↗★ 59

dsh-knowledge

Cherry Studio-style knowledge base system for DeepSeek Harness (DSH): bases, documents, chunking, embeddings (OpenAI-compatible / Ollama / local / lexical fallback), retrieval, model-facing tools, and a browser management panel 适合需要构建本地或远程向量知识库并让模型检索参考的用户。

패키지
dsh-knowledge
호환성
미검증
버전
0.4.1
라이선스
AGPL-3.0
최근 업데이트
2026. 9. 28.

같은 패키지 이름의 다른 저장소

설치

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Soren-ABT/dsh-knowledge

3. 完成首次配置

  1. 点击侧边栏底部、设置旁的“知识库”入口。
  2. 新建知识库并导入文件、目录、网页或文本。
  3. 如需本地向量检索,在“设置 > 本地模型”下载 embedding 模型;也可以配置 OpenAI 兼容服务或 Ollama。
  4. 如需识别扫描件,再下载约 21 MB 的 OCR 模型。
  5. 在“召回测试”中检查结果,再让模型通过 knowledge_search 使用知识库。

不下载模型也可以使用关键词检索。扫描件 OCR、本地 embedding 和本地 rerank 只有在对应模型已下载并通过就绪检查后才启用。

其他安装方式


## 配置

部署默认值位于 `cordis.patch.yml` 的 `knowledge` 行。管理面板可以在运行时覆盖并持久化这些值;大多数检索和文档设置还可以按知识库覆盖。

查看完整配置字段

| 字段 | 默认 | 说明 |
|---|---:|---|
| `embeddingProvider` | `none` | `openai`、`ollama`、`local` 或 `none` |
| `embeddingBaseUrl` | `''` | embedding API 基址;Ollama 空值回退到本地标准端点 |
| `embeddingModel` | `''` | 远程模型名或 Hugging Face 本地模型仓库 ID |
| `embeddingApiKey` | `''` | 也可通过 `KNOWLEDGE_API_KEY` 设置 |
| `rerankModel` / `rerankBaseUrl` / `rerankApiKey` | `''` | 远程或 `local:` 重排;空模型表示关闭 |
| `localRerankTimeoutMs` | `60000` | 本地重排总预算,范围 10,000–300,000 ms,包含排队时间 |
| `smartChunk` | `true` | 标题/段落感知分块;关闭后只使用分隔符 |
| `chunkSeparator` | `\n\n` | `smartChunk` 关闭时的分隔符 |
| `chunkSize` | `800` | 分块 Token 目标预算 |
| `chunkOverlap` | `100` | 相邻分块重叠 Token 预算 |
| `topK` | `4` | 默认检索结果数,允许 1–50 |
| `searchMode` | `auto` | `auto`、`hybrid`、`vector` 或 `lexical` |
| `similarityThreshold` | `0` | 结果最低相似度,范围 0–1 |
| `mmrDiversity` | `0` | MMR 多样性,`0` 表示关闭 |
| `rrfVectorWeight` | `1` | hybrid 模式中向量召回的 RRF 权重 |
| `embeddingBatchSize` | `32` | 每批 embedding 文本数 |
| `siblingChunks` | `1` | 每侧相邻 chunk 数,范围 0–3;`0` 仍生成 anchor-only 窗口 |
| `semanticChunk` | `false` | 合并相邻相似语义段落 |
| `semanticChunkThreshold` | `0.75` | 语义分块余弦阈值 |
| `chunkTokenLimit` | `0` | 分块 Token 硬上限;`0` 表示不限制 |
| `conflictStrategy` | `rename` | 同名导入使用 `keep`、`replace` 或 `rename` |
| `urlRefreshHours` | `0` | URL 自动刷新间隔;`0` 表示关闭 |
| `imageCaptionProvider` | `off` | `off`、`openai` 或 `ollama` |
| `imageCaptionModel` | `''` | 图表描述使用的视觉模型 ID |
| `imageCaptionBaseUrl` | `''` | 图表描述 API 基址 |
| `imageCaptionApiKey` | `''` | OpenAI 兼容视觉服务密钥 |
| `hfEndpoint` | `''` | Hugging Face 下载端点或镜像 |
| `documentProcessorProvider` | `builtin` | `builtin` 本地解析或 `mineru` 远程处理 |
| `mineruApiKey` | `''` | MinerU 模式需要的 API Key |
| `mineruApiHost` | `''` | 空值使用 `https://mineru.net` |
| `resumeInterruptedOnStartup` | `true` | 启动时恢复中断的导入 |
| `autoRetrieve` | `true` | 用户消息进入时自动检索并注入相关背景 |
| `autoRetrieveWeight` | `3` | 每库自动注入席位上限,范围 0–5;`0` 表示排除 |
| `localModelCacheDir` | `''` | 空值使用 `/cache/dsh-knowledge/local-models` |
| `localWorkerIdleTimeoutMs` | `60000` | 本地 embedding process 空闲释放模型 session 的时间;`0` 表示常驻 |
| `chunkStorePath` | `''` | 空值使用 `/storages/knowledge-chunks.sqlite` |

按库设置中的空字段继承全局配置。`localModelCacheDir`、`localWorkerIdleTimeoutMs` 和 `chunkStorePath` 是进程级设置。API Key 以明文保存在本地机器,请保护 profile 数据目录。

---