From 2ca6f992c7db58f5cb3f758bc3fe07d0721a96cb Mon Sep 17 00:00:00 2001 From: "openclaw-docs-i18n[bot]" Date: Sat, 25 Apr 2026 23:16:22 +0000 Subject: [PATCH] chore(i18n): refresh zh-CN translations --- docs/zh-CN/concepts/memory-search.md | 68 ++--- docs/zh-CN/reference/memory-config.md | 394 +++++++++++++------------- 2 files changed, 236 insertions(+), 226 deletions(-) diff --git a/docs/zh-CN/concepts/memory-search.md b/docs/zh-CN/concepts/memory-search.md index 5e62a15ab..5a9781346 100644 --- a/docs/zh-CN/concepts/memory-search.md +++ b/docs/zh-CN/concepts/memory-search.md @@ -1,24 +1,24 @@ --- read_when: - - 你想了解 `memory_search` 是如何工作的 + - 你想了解 memory_search 的工作原理 - 你想选择一个嵌入提供商 - - 你想调整搜索质量 -summary: 记忆搜索如何使用嵌入和混合检索来查找相关笔记 -title: 记忆搜索 + - 你想优化搜索质量 +summary: 内存搜索如何使用嵌入和混合检索来找到相关笔记 +title: 内存搜索 x-i18n: - generated_at: "2026-04-25T07:22:21Z" + generated_at: "2026-04-25T23:14:59Z" model: gpt-5.4 provider: openai - source_hash: 5cc6bbaf7b0a755bbe44d3b1b06eed7f437ebdc41a81c48cca64bd08bbc546b7 + source_hash: 95d86fb3efe79aae92f5e3590f1c15fb0d8f3bb3301f8fe9a41f891e290d7a14 source_path: concepts/memory-search.md workflow: 15 --- -`memory_search` 会从你的记忆文件中查找相关笔记,即使措辞与原始文本不同也可以。它通过将记忆索引为小块,并使用嵌入、关键词或两者结合来搜索这些内容。 +`memory_search` 会从你的内存文件中找到相关笔记,即使措辞与原始文本不同也可以。它通过将内存索引为小块,并使用嵌入、关键词或两者结合来进行搜索。 ## 快速开始 -如果你已配置 GitHub Copilot 订阅、OpenAI、Gemini、Voyage 或 Mistral 的 API key,记忆搜索会自动生效。要显式设置提供商: +如果你已配置 GitHub Copilot 订阅、OpenAI、Gemini、Voyage 或 Mistral API 密钥,内存搜索会自动工作。若要显式设置提供商: ```json5 { @@ -32,13 +32,13 @@ x-i18n: } ``` -如果你想使用无需 API key 的本地嵌入,请在 OpenClaw 旁边安装可选的 `node-llama-cpp` 运行时包,并使用 `provider: "local"`。 +如果要在没有 API 密钥的情况下使用本地嵌入,请在 OpenClaw 旁边安装可选的 `node-llama-cpp` 运行时包,并使用 `provider: "local"`。 ## 支持的提供商 -| 提供商 | ID | 需要 API key | 说明 | +| 提供商 | ID | 需要 API 密钥 | 说明 | | -------------- | ---------------- | ------------- | ---------------------------------------------------- | -| Bedrock | `bedrock` | 否 | 当 AWS 凭证链解析成功时自动检测 | +| Bedrock | `bedrock` | 否 | 当 AWS 凭证链可解析时自动检测 | | Gemini | `gemini` | 是 | 支持图像/音频索引 | | GitHub Copilot | `github-copilot` | 否 | 自动检测,使用 Copilot 订阅 | | Local | `local` | 否 | GGUF 模型,下载大小约 0.6 GB | @@ -62,31 +62,31 @@ flowchart LR M --> R["Top Results"] ``` -- **向量搜索** 会查找语义相近的笔记(“gateway host” 可匹配 “the machine running OpenClaw”)。 -- **BM25 关键词搜索** 会查找精确匹配(ID、错误字符串、配置键)。 +- **向量搜索** 会找到含义相近的笔记(“gateway host” 可匹配 “the machine running OpenClaw”)。 +- **BM25 关键词搜索** 会找到精确匹配(ID、错误字符串、配置键)。 如果只有一条路径可用(没有嵌入或没有 FTS),则只运行另一条路径。 -当嵌入不可用时,OpenClaw 仍会对 FTS 结果使用词法排序,而不是只退回到原始精确匹配顺序。这种降级模式会提升那些查询词覆盖更强、文件路径更相关的内容块,因此即使没有 `sqlite-vec` 或嵌入提供商,也能保持较好的召回效果。 +当嵌入不可用时,OpenClaw 仍会对 FTS 结果使用词法排序,而不是仅退回到原始精确匹配排序。这种降级模式会提升那些查询词覆盖更强、文件路径更相关的分块,因此即使没有 `sqlite-vec` 或嵌入提供商,也能保持不错的召回效果。 -## 改进搜索质量 +## 提升搜索质量 -当你拥有大量笔记历史时,有两个可选功能会很有帮助: +当你有大量笔记历史时,有两个可选功能会很有帮助: ### 时间衰减 -旧笔记的排序权重会逐渐降低,因此最近的信息会优先显示。使用默认的 30 天半衰期时,上个月的笔记得分会降到原始权重的 50%。像 `MEMORY.md` 这样的常青文件永远不会衰减。 +旧笔记的排名权重会逐渐降低,因此最近的信息会优先显示。默认半衰期为 30 天,因此上个月的笔记得分会降为原始权重的 50%。像 `MEMORY.md` 这样的常青文件永远不会衰减。 -如果你的智能体已经积累了数月的每日笔记,而过时信息总是排在最近上下文之前,请启用时间衰减。 +如果你的智能体有数月的每日笔记,且过时信息总是排在最近上下文之前,请启用时间衰减。 ### MMR(多样性) -减少重复结果。如果五条笔记都提到了同一个路由器配置,MMR 会确保顶部结果覆盖不同主题,而不是重复相同内容。 +减少重复结果。如果五条笔记都提到了同一个路由器配置,MMR 会确保顶部结果覆盖不同主题,而不是重复相似内容。 -如果 `memory_search` 总是从不同的每日笔记中返回几乎重复的片段,请启用 MMR。 +如果 `memory_search` 总是从不同的每日笔记中返回近似重复的片段,请启用 MMR。 ### 同时启用两者 @@ -108,30 +108,32 @@ flowchart LR } ``` -## 多模态记忆 +## 多模态内存 -使用 Gemini Embedding 2 时,你可以在 Markdown 之外为图像和音频文件建立索引。搜索查询仍然是文本,但会匹配视觉和音频内容。设置方法请参阅[记忆配置参考](/zh-CN/reference/memory-config)。 +使用 Gemini Embedding 2 时,你可以在 Markdown 之外一并索引图像和音频文件。搜索查询仍然是文本,但会匹配视觉和音频内容。设置方式请参见[内存配置参考](/zh-CN/reference/memory-config)。 -## 会话记忆搜索 +## 会话内存搜索 -你还可以选择为会话转录建立索引,这样 `memory_search` 就能回忆更早的对话。这是通过 `memorySearch.experimental.sessionMemory` 选择启用的。详情请参阅[配置参考](/zh-CN/reference/memory-config)。 +你还可以选择为会话转录建立索引,这样 `memory_search` 就能回忆更早的对话。这是通过 `memorySearch.experimental.sessionMemory` 选择启用的。详情请参见[配置参考](/zh-CN/reference/memory-config)。 ## 故障排除 -**没有结果?** 运行 `openclaw memory status` 检查索引。如果为空,运行 `openclaw memory index --force`。 +**没有结果?** 运行 `openclaw memory status` 检查索引。如果为空,请运行 `openclaw memory index --force`。 -**只有关键词匹配?** 你的嵌入提供商可能尚未配置。检查 `openclaw memory status --deep`。 +**只有关键词匹配?** 你的嵌入提供商可能未配置。请检查 `openclaw memory status --deep`。 -**找不到 CJK 文本?** 使用 `openclaw memory index --force` 重建 FTS 索引。 +**本地嵌入超时?** `ollama`、`lmstudio` 和 `local` 默认使用更长的内联批处理超时时间。如果只是宿主机较慢,请设置 `agents.defaults.memorySearch.sync.embeddingBatchTimeoutSeconds`,然后重新运行 `openclaw memory index --force`。 + +**找不到 CJK 文本?** 请使用 `openclaw memory index --force` 重建 FTS 索引。 ## 延伸阅读 -- [Active Memory](/zh-CN/concepts/active-memory) -- 用于交互式聊天会话的子智能体记忆 -- [Memory](/zh-CN/concepts/memory) -- 文件布局、后端、工具 -- [记忆配置参考](/zh-CN/reference/memory-config) -- 所有配置项 +- [Active Memory](/zh-CN/concepts/active-memory) -- 用于交互式聊天会话的子智能体内存 +- [内存](/zh-CN/concepts/memory) -- 文件布局、后端、工具 +- [内存配置参考](/zh-CN/reference/memory-config) -- 所有配置项 ## 相关内容 -- [记忆概览](/zh-CN/concepts/memory) -- [Active memory](/zh-CN/concepts/active-memory) -- [内置记忆引擎](/zh-CN/concepts/memory-builtin) +- [内存概览](/zh-CN/concepts/memory) +- [Active Memory](/zh-CN/concepts/active-memory) +- [内置内存引擎](/zh-CN/concepts/memory-builtin) diff --git a/docs/zh-CN/reference/memory-config.md b/docs/zh-CN/reference/memory-config.md index 9e4d1030f..baa929a37 100644 --- a/docs/zh-CN/reference/memory-config.md +++ b/docs/zh-CN/reference/memory-config.md @@ -1,79 +1,79 @@ --- read_when: - - 你想配置 memory 搜索提供商或嵌入模型 - - 你想设置 QMD 后端 - - 你想调整混合搜索、MMR 或时间衰减 - - 你想启用多模态 memory 索引 -summary: Memory 搜索、嵌入提供商、QMD、混合搜索和多模态索引的所有配置项 -title: Memory 配置参考 + - 你想要配置内存搜索提供商或嵌入模型 + - 你想要设置 QMD 后端 + - 你想要调整混合搜索、MMR 或时间衰减 + - 你想要启用多模态内存索引 +summary: 内存搜索、嵌入提供商、QMD、混合搜索和多模态索引的所有配置选项 +title: 内存配置参考 x-i18n: - generated_at: "2026-04-24T03:43:35Z" + generated_at: "2026-04-25T23:14:59Z" model: gpt-5.4 provider: openai - source_hash: b9152d6cdf3959319c2ba000fae06c72b27b9b8c90ee08ce57b80d1c0670f850 + source_hash: 6c3e000969bee0d3ed0174e61df17c7da4166ef949db86405e2730e9d95002ea source_path: reference/memory-config.md workflow: 15 --- -本页列出了 OpenClaw memory 搜索的所有配置项。如需概念概览,请参见: +此页面列出了 OpenClaw 内存搜索的所有配置选项。有关概念概览,请参见: -- [Memory Overview](/zh-CN/concepts/memory) -- memory 的工作方式 -- [Builtin Engine](/zh-CN/concepts/memory-builtin) -- 默认的 SQLite 后端 -- [QMD Engine](/zh-CN/concepts/memory-qmd) -- 本地优先 sidecar -- [Memory Search](/zh-CN/concepts/memory-search) -- 搜索流水线与调优 -- [Active Memory](/zh-CN/concepts/active-memory) -- 为交互式会话启用 memory 子智能体 +- [Memory Overview](/zh-CN/concepts/memory) —— 内存的工作方式 +- [Builtin Engine](/zh-CN/concepts/memory-builtin) —— 默认的 SQLite 后端 +- [QMD Engine](/zh-CN/concepts/memory-qmd) —— 本地优先的 sidecar +- [Memory Search](/zh-CN/concepts/memory-search) —— 搜索流水线与调优 +- [Active Memory](/zh-CN/concepts/active-memory) —— 为交互式会话启用内存子智能体 -除非另有说明,所有 memory 搜索设置都位于 `openclaw.json` 的 `agents.defaults.memorySearch` 下。 +除非另有说明,所有内存搜索设置都位于 `openclaw.json` 中的 `agents.defaults.memorySearch` 下。 -如果你要找的是 **active memory** 功能开关和子智能体配置,它位于 `plugins.entries.active-memory` 下,而不是 `memorySearch`。 +如果你要查找 **active memory** 的功能开关和子智能体配置,它位于 `plugins.entries.active-memory` 下,而不是 `memorySearch` 下。 Active memory 使用双门控模型: -1. 插件必须已启用,并且目标是当前智能体 id -2. 请求必须是符合条件的交互式持久聊天会话 +1. 该插件必须已启用,并且目标指向当前智能体 ID +2. 该请求必须是符合条件的交互式持久聊天会话 -关于激活模型、插件自有配置、转录持久化和安全推出模式,请参见 [Active Memory](/zh-CN/concepts/active-memory)。 +有关激活模型、插件自有配置、转录持久化以及安全的渐进式发布模式,请参见 [Active Memory](/zh-CN/concepts/active-memory)。 --- ## 提供商选择 -| Key | 类型 | 默认值 | 说明 | -| ---------- | --------- | -------------- | ----------------------------------------------------------------------------------------------------- | +| 键 | 类型 | 默认值 | 说明 | +| ---------- | --------- | -------------- | --------------------------------------------------------------------------------------------------------------- | | `provider` | `string` | 自动检测 | 嵌入适配器 ID:`bedrock`、`gemini`、`github-copilot`、`local`、`mistral`、`ollama`、`openai`、`voyage` | -| `model` | `string` | 提供商默认值 | 嵌入模型名称 | -| `fallback` | `string` | `"none"` | 主提供商失败时使用的回退适配器 ID | -| `enabled` | `boolean` | `true` | 启用或禁用 memory 搜索 | +| `model` | `string` | 提供商默认值 | 嵌入模型名称 | +| `fallback` | `string` | `"none"` | 主提供商失败时使用的后备适配器 ID | +| `enabled` | `boolean` | `true` | 启用或禁用内存搜索 | ### 自动检测顺序 -当未设置 `provider` 时,OpenClaw 会选择第一个可用项: +当未设置 `provider` 时,OpenClaw 会选择第一个可用的提供商: -1. `local` -- 如果已配置 `memorySearch.local.modelPath` 且文件存在。 -2. `github-copilot` -- 如果可以解析到 GitHub Copilot token(环境变量或 auth profile)。 -3. `openai` -- 如果可以解析到 OpenAI key。 -4. `gemini` -- 如果可以解析到 Gemini key。 -5. `voyage` -- 如果可以解析到 Voyage key。 -6. `mistral` -- 如果可以解析到 Mistral key。 -7. `bedrock` -- 如果 AWS SDK 凭证链可解析(实例角色、访问密钥、profile、SSO、web identity 或共享配置)。 +1. `local` —— 如果已配置 `memorySearch.local.modelPath` 且该文件存在。 +2. `github-copilot` —— 如果可以解析到 GitHub Copilot token(环境变量或认证配置文件)。 +3. `openai` —— 如果可以解析到 OpenAI 密钥。 +4. `gemini` —— 如果可以解析到 Gemini 密钥。 +5. `voyage` —— 如果可以解析到 Voyage 密钥。 +6. `mistral` —— 如果可以解析到 Mistral 密钥。 +7. `bedrock` —— 如果 AWS SDK 凭证链可以成功解析(实例角色、访问密钥、配置文件、SSO、Web 身份或共享配置)。 -支持 `ollama`,但不会自动检测(需要显式设置)。 +支持 `ollama`,但不会自动检测到它(需要显式设置)。 -### API key 解析 +### API 密钥解析 -远程嵌入需要 API key。Bedrock 则改用 AWS SDK 默认凭证链(实例角色、SSO、访问密钥)。 +远程嵌入需要 API 密钥。Bedrock 则改用 AWS SDK 默认凭证链(实例角色、SSO、访问密钥)。 | 提供商 | 环境变量 | 配置键 | | -------------- | -------------------------------------------------- | --------------------------------- | -| Bedrock | AWS 凭证链 | 不需要 API key | +| Bedrock | AWS 凭证链 | 不需要 API 密钥 | | Gemini | `GEMINI_API_KEY` | `models.providers.google.apiKey` | -| GitHub Copilot | `COPILOT_GITHUB_TOKEN`、`GH_TOKEN`、`GITHUB_TOKEN` | 通过设备登录的 auth profile | +| GitHub Copilot | `COPILOT_GITHUB_TOKEN`, `GH_TOKEN`, `GITHUB_TOKEN` | 通过设备登录的认证配置文件 | | Mistral | `MISTRAL_API_KEY` | `models.providers.mistral.apiKey` | -| Ollama | `OLLAMA_API_KEY`(占位用) | -- | +| Ollama | `OLLAMA_API_KEY`(占位) | -- | | OpenAI | `OPENAI_API_KEY` | `models.providers.openai.apiKey` | | Voyage | `VOYAGE_API_KEY` | `models.providers.voyage.apiKey` | -Codex OAuth 仅覆盖 chat/completions,不满足嵌入请求。 +Codex OAuth 仅覆盖聊天/补全,不满足嵌入请求的认证要求。 --- @@ -81,11 +81,11 @@ Codex OAuth 仅覆盖 chat/completions,不满足嵌入请求。 用于自定义 OpenAI 兼容端点或覆盖提供商默认值: -| Key | 类型 | 说明 | -| ---------------- | -------- | ------------------------------------- | -| `remote.baseUrl` | `string` | 自定义 API base URL | -| `remote.apiKey` | `string` | 覆盖 API key | -| `remote.headers` | `object` | 额外的 HTTP headers(与提供商默认值合并) | +| 键 | 类型 | 说明 | +| ---------------- | -------- | ------------------------------------ | +| `remote.baseUrl` | `string` | 自定义 API 基础 URL | +| `remote.apiKey` | `string` | 覆盖 API 密钥 | +| `remote.headers` | `object` | 额外的 HTTP 标头(与提供商默认值合并) | ```json5 { @@ -106,23 +106,23 @@ Codex OAuth 仅覆盖 chat/completions,不满足嵌入请求。 --- -## Gemini 专用配置 +## Gemini 专属配置 -| Key | 类型 | 默认值 | 说明 | -| ---------------------- | -------- | ---------------------- | ------------------------------------- | -| `model` | `string` | `gemini-embedding-001` | 也支持 `gemini-embedding-2-preview` | -| `outputDimensionality` | `number` | `3072` | 对于 Embedding 2:768、1536 或 3072 | +| 键 | 类型 | 默认值 | 说明 | +| ---------------------- | -------- | ---------------------- | ------------------------------------------ | +| `model` | `string` | `gemini-embedding-001` | 也支持 `gemini-embedding-2-preview` | +| `outputDimensionality` | `number` | `3072` | 对于 Embedding 2:可选 768、1536 或 3072 | -更改模型或 `outputDimensionality` 会触发自动全量重新索引。 +更改模型或 `outputDimensionality` 会触发自动全量重建索引。 --- ## Bedrock 嵌入配置 -Bedrock 使用 AWS SDK 默认凭证链——不需要 API key。 -如果 OpenClaw 在启用了 Bedrock 的实例角色的 EC2 上运行,只需设置提供商和模型: +Bedrock 使用 AWS SDK 默认凭证链 —— 不需要 API 密钥。 +如果 OpenClaw 运行在具有 Bedrock 权限实例角色的 EC2 上,只需设置提供商和模型: ```json5 { @@ -137,27 +137,27 @@ Bedrock 使用 AWS SDK 默认凭证链——不需要 API key。 } ``` -| Key | 类型 | 默认值 | 说明 | -| ---------------------- | -------- | ------------------------------ | --------------------------- | -| `model` | `string` | `amazon.titan-embed-text-v2:0` | 任意 Bedrock 嵌入模型 ID | +| 键 | 类型 | 默认值 | 说明 | +| ---------------------- | -------- | ------------------------------ | ------------------------- | +| `model` | `string` | `amazon.titan-embed-text-v2:0` | 任意 Bedrock 嵌入模型 ID | | `outputDimensionality` | `number` | 模型默认值 | 对于 Titan V2:256、512 或 1024 | ### 支持的模型 -支持以下模型(含家族检测和默认维度): +支持以下模型(包含系列检测和维度默认值): -| 模型 ID | 提供商 | 默认维度 | 可配置维度 | -| ------------------------------------------ | ---------- | -------- | --------------------- | -| `amazon.titan-embed-text-v2:0` | Amazon | 1024 | 256、512、1024 | -| `amazon.titan-embed-text-v1` | Amazon | 1536 | -- | -| `amazon.titan-embed-g1-text-02` | Amazon | 1536 | -- | -| `amazon.titan-embed-image-v1` | Amazon | 1024 | -- | -| `amazon.nova-2-multimodal-embeddings-v1:0` | Amazon | 1024 | 256、384、1024、3072 | -| `cohere.embed-english-v3` | Cohere | 1024 | -- | -| `cohere.embed-multilingual-v3` | Cohere | 1024 | -- | -| `cohere.embed-v4:0` | Cohere | 1536 | 256 - 1536 | -| `twelvelabs.marengo-embed-3-0-v1:0` | TwelveLabs | 512 | -- | -| `twelvelabs.marengo-embed-2-7-v1:0` | TwelveLabs | 1024 | -- | +| 模型 ID | 提供商 | 默认维度 | 可配置维度 | +| ------------------------------------------ | ---------- | -------- | -------------------- | +| `amazon.titan-embed-text-v2:0` | Amazon | 1024 | 256、512、1024 | +| `amazon.titan-embed-text-v1` | Amazon | 1536 | -- | +| `amazon.titan-embed-g1-text-02` | Amazon | 1536 | -- | +| `amazon.titan-embed-image-v1` | Amazon | 1024 | -- | +| `amazon.nova-2-multimodal-embeddings-v1:0` | Amazon | 1024 | 256、384、1024、3072 | +| `cohere.embed-english-v3` | Cohere | 1024 | -- | +| `cohere.embed-multilingual-v3` | Cohere | 1024 | -- | +| `cohere.embed-v4:0` | Cohere | 1536 | 256-1536 | +| `twelvelabs.marengo-embed-3-0-v1:0` | TwelveLabs | 512 | -- | +| `twelvelabs.marengo-embed-2-7-v1:0` | TwelveLabs | 1024 | -- | 带吞吐后缀的变体(例如 `amazon.titan-embed-text-v1:2:8k`)会继承基础模型的配置。 @@ -167,11 +167,11 @@ Bedrock 认证使用标准 AWS SDK 凭证解析顺序: 1. 环境变量(`AWS_ACCESS_KEY_ID` + `AWS_SECRET_ACCESS_KEY`) 2. SSO token 缓存 -3. Web identity token 凭证 +3. Web 身份 token 凭证 4. 共享凭证和配置文件 5. ECS 或 EC2 元数据凭证 -区域会从 `AWS_REGION`、`AWS_DEFAULT_REGION`、`amazon-bedrock` 提供商的 `baseUrl` 中解析,若都未设置则默认为 `us-east-1`。 +区域会从 `AWS_REGION`、`AWS_DEFAULT_REGION`、`amazon-bedrock` 提供商的 `baseUrl` 中解析,或默认使用 `us-east-1`。 ### IAM 权限 @@ -185,7 +185,7 @@ IAM 角色或用户需要: } ``` -若要实现最小权限,请将 `InvokeModel` 限定到特定模型: +为了遵循最小权限原则,请将 `InvokeModel` 限定到具体模型: ``` arn:aws:bedrock:*::foundation-model/amazon.titan-embed-text-v2:0 @@ -195,24 +195,33 @@ arn:aws:bedrock:*::foundation-model/amazon.titan-embed-text-v2:0 ## 本地嵌入配置 -| Key | 类型 | 默认值 | 说明 | -| --------------------- | ------------------ | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `local.modelPath` | `string` | 自动下载 | GGUF 模型文件路径 | -| `local.modelCacheDir` | `string` | node-llama-cpp 默认值 | 下载模型的缓存目录 | -| `local.contextSize` | `number \| "auto"` | `4096` | 嵌入上下文的上下文窗口大小。4096 可覆盖典型分块(128–512 tokens),同时限制非权重 VRAM 占用。在资源受限的主机上可降低到 1024–2048。`"auto"` 会使用模型训练时的最大值——不推荐用于 8B+ 模型(Qwen3-Embedding-8B:40 960 tokens → 约 32 GB VRAM,而 4096 时约为 8.8 GB)。 | +| 键 | 类型 | 默认值 | 说明 | +| --------------------- | ------------------ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `local.modelPath` | `string` | 自动下载 | GGUF 模型文件路径 | +| `local.modelCacheDir` | `string` | `node-llama-cpp` 默认值 | 已下载模型的缓存目录 | +| `local.contextSize` | `number \| "auto"` | `4096` | 嵌入上下文的上下文窗口大小。4096 可覆盖典型分块(128–512 tokens),同时限制非权重显存占用。在资源受限的主机上可降至 1024–2048。`"auto"` 会使用模型训练时的最大值 —— 不建议用于 8B+ 模型(Qwen3-Embedding-8B:40 960 tokens → 约 32 GB VRAM,而在 4096 时约为 8.8 GB)。 | 默认模型:`embeddinggemma-300m-qat-Q8_0.gguf`(约 0.6 GB,自动下载)。 -需要原生构建:`pnpm approve-builds` 然后 `pnpm rebuild node-llama-cpp`。 +需要原生构建:`pnpm approve-builds`,然后执行 `pnpm rebuild node-llama-cpp`。 -使用独立 CLI 验证 Gateway 网关所使用的同一路径提供商: +使用独立 CLI 来验证与 Gateway 网关 相同的提供商路径: ```bash openclaw memory status --deep --agent main openclaw memory index --force --agent main ``` -如果 `provider` 为 `auto`,只有当 `local.modelPath` 指向磁盘上已有的本地文件时,才会选择 `local`。 -`hf:` 和 HTTP(S) 模型引用仍可在显式设置 `provider: "local"` 时使用,但在模型实际落盘之前,它们不会让 `auto` 优先选择 local。 +如果 `provider` 为 `auto`,只有当 `local.modelPath` 指向一个已存在的本地文件时,才会选择 `local`。`hf:` 和 HTTP(S) 模型引用仍可在 `provider: "local"` 时显式使用,但在模型尚未存在于磁盘上之前,它们不会让 `auto` 优先选择 local。 + +### 内联嵌入超时 + +| 键 | 类型 | 默认值 | 说明 | +| ----------------------------------- | -------- | -------------- | -------------------------------------------- | +| `sync.embeddingBatchTimeoutSeconds` | `number` | 提供商默认值 | 覆盖内存索引期间内联嵌入批次的超时时间 | + +未设置时,将使用提供商默认值:对于 `local`、`ollama` 和 `lmstudio` 等本地/自托管提供商为 600 秒,对于托管提供商为 120 秒。 + +当本地 CPU 受限的嵌入批次运行正常但速度较慢时,请增大此值。 --- @@ -220,28 +229,28 @@ openclaw memory index --force --agent main 全部位于 `memorySearch.query.hybrid` 下: -| Key | 类型 | 默认值 | 说明 | -| --------------------- | --------- | ------ | ---------------------------- | -| `enabled` | `boolean` | `true` | 启用混合 BM25 + 向量搜索 | -| `vectorWeight` | `number` | `0.7` | 向量分数权重(0 - 1) | -| `textWeight` | `number` | `0.3` | BM25 分数权重(0 - 1) | -| `candidateMultiplier` | `number` | `4` | 候选池大小倍数 | +| 键 | 类型 | 默认值 | 说明 | +| --------------------- | --------- | ------- | ---------------------------- | +| `enabled` | `boolean` | `true` | 启用混合 BM25 + 向量搜索 | +| `vectorWeight` | `number` | `0.7` | 向量分数的权重(0-1) | +| `textWeight` | `number` | `0.3` | BM25 分数的权重(0-1) | +| `candidateMultiplier` | `number` | `4` | 候选池大小乘数 | ### MMR(多样性) -| Key | 类型 | 默认值 | 说明 | -| ------------- | --------- | ------ | ---------------------------------- | -| `mmr.enabled` | `boolean` | `false` | 启用 MMR 重新排序 | -| `mmr.lambda` | `number` | `0.7` | 0 = 最大多样性,1 = 最大相关性 | +| 键 | 类型 | 默认值 | 说明 | +| ------------- | --------- | ------- | ---------------------------------- | +| `mmr.enabled` | `boolean` | `false` | 启用 MMR 重排序 | +| `mmr.lambda` | `number` | `0.7` | 0 = 最大多样性,1 = 最大相关性 | ### 时间衰减(新近性) -| Key | 类型 | 默认值 | 说明 | -| ---------------------------- | --------- | ------ | ----------------------- | +| 键 | 类型 | 默认值 | 说明 | +| ---------------------------- | --------- | ------- | ----------------------- | | `temporalDecay.enabled` | `boolean` | `false` | 启用新近性加权 | -| `temporalDecay.halfLifeDays` | `number` | `30` | 分数每 N 天衰减为一半 | +| `temporalDecay.halfLifeDays` | `number` | `30` | 分数每 N 天减半 | -常青文件(`MEMORY.md`、`memory/` 中不带日期的文件)永远不会被衰减。 +常青文件(`MEMORY.md`、`memory/` 中不带日期的文件)永远不会衰减。 ### 完整示例 @@ -266,11 +275,11 @@ openclaw memory index --force --agent main --- -## 其他 memory 路径 +## 其他内存路径 -| Key | 类型 | 说明 | -| ------------ | ---------- | ---------------------------- | -| `extraPaths` | `string[]` | 要索引的其他目录或文件路径 | +| 键 | 类型 | 说明 | +| ------------ | ---------- | ---------------------------------- | +| `extraPaths` | `string[]` | 要建立索引的其他目录或文件 | ```json5 { @@ -284,80 +293,79 @@ openclaw memory index --force --agent main } ``` -路径可以是绝对路径,也可以相对于工作区。目录会递归扫描 `.md` 文件。符号链接的处理取决于当前后端:内置引擎会忽略符号链接,而 QMD 会遵循底层 QMD 扫描器的行为。 +路径可以是绝对路径,也可以是相对于工作区的路径。目录会递归扫描其中的 `.md` 文件。符号链接的处理取决于当前使用的后端:内置引擎会忽略符号链接,而 QMD 会遵循底层 QMD 扫描器的行为。 -对于按智能体范围的跨智能体 transcript 搜索,请使用 -`agents.list[].memorySearch.qmd.extraCollections`,而不是 `memory.qmd.paths`。 -这些额外集合遵循相同的 `{ path, name, pattern? }` 结构,但会按智能体进行合并,并且当路径指向当前工作区之外时,可以保留显式共享名称。 -如果同一个解析后路径同时出现在 `memory.qmd.paths` 和 -`memorySearch.qmd.extraCollections` 中,QMD 会保留第一个条目并跳过重复项。 +对于按智能体范围进行的跨智能体转录搜索,请使用 `agents.list[].memorySearch.qmd.extraCollections`,而不是 `memory.qmd.paths`。这些额外集合遵循相同的 `{ path, name, pattern? }` 结构,但会按智能体进行合并,并且当路径指向当前工作区之外时,可以保留显式指定的共享名称。 +如果同一个已解析路径同时出现在 `memory.qmd.paths` 和 `memorySearch.qmd.extraCollections` 中,QMD 会保留第一项并跳过重复项。 --- -## 多模态 memory(Gemini) +## 多模态内存(Gemini) -使用 Gemini Embedding 2 将图片和音频与 Markdown 一起建立索引: +使用 Gemini Embedding 2 为图像和音频与 Markdown 一起建立索引: -| Key | 类型 | 默认值 | 说明 | -| ------------------------- | ---------- | ---------- | ------------------------------------- | -| `multimodal.enabled` | `boolean` | `false` | 启用多模态索引 | -| `multimodal.modalities` | `string[]` | -- | `["image"]`、`["audio"]` 或 `["all"]` | -| `multimodal.maxFileBytes` | `number` | `10000000` | 建立索引时允许的最大文件大小 | +| 键 | 类型 | 默认值 | 说明 | +| ------------------------- | ---------- | ---------- | -------------------------------------- | +| `multimodal.enabled` | `boolean` | `false` | 启用多模态索引 | +| `multimodal.modalities` | `string[]` | -- | `["image"]`、`["audio"]` 或 `["all"]` | +| `multimodal.maxFileBytes` | `number` | `10000000` | 建立索引的最大文件大小 | -仅适用于 `extraPaths` 中的文件。默认 memory 根目录仍只索引 Markdown。 +仅适用于 `extraPaths` 中的文件。默认内存根目录仍然只索引 Markdown。 需要 `gemini-embedding-2-preview`。`fallback` 必须为 `"none"`。 支持的格式:`.jpg`、`.jpeg`、`.png`、`.webp`、`.gif`、`.heic`、`.heif` -(图片);`.mp3`、`.wav`、`.ogg`、`.opus`、`.m4a`、`.aac`、`.flac`(音频)。 +(图像);`.mp3`、`.wav`、`.ogg`、`.opus`、`.m4a`、`.aac`、`.flac`(音频)。 --- ## 嵌入缓存 -| Key | 类型 | 默认值 | 说明 | -| ------------------ | --------- | ------ | -------------------------------- | -| `cache.enabled` | `boolean` | `false` | 在 SQLite 中缓存 chunk 嵌入 | -| `cache.maxEntries` | `number` | `50000` | 最大缓存嵌入条目数 | +| 键 | 类型 | 默认值 | 说明 | +| ------------------ | --------- | ------- | --------------------------------- | +| `cache.enabled` | `boolean` | `false` | 在 SQLite 中缓存分块嵌入 | +| `cache.maxEntries` | `number` | `50000` | 最大缓存嵌入数量 | -可防止在重新索引或 transcript 更新时,对未变更的文本重复生成嵌入。 +可防止在重建索引或更新转录时,对未更改的文本重复进行嵌入。 --- ## 批量索引 -| Key | 类型 | 默认值 | 说明 | -| ----------------------------- | --------- | ------ | ---------------------- | -| `remote.batch.enabled` | `boolean` | `false` | 启用批量嵌入 API | -| `remote.batch.concurrency` | `number` | `2` | 并行批处理任务数 | -| `remote.batch.wait` | `boolean` | `true` | 等待批处理完成 | -| `remote.batch.pollIntervalMs` | `number` | -- | 轮询间隔 | -| `remote.batch.timeoutMinutes` | `number` | -- | 批处理超时时间 | +| 键 | 类型 | 默认值 | 说明 | +| ----------------------------- | --------- | ------- | ------------------------ | +| `remote.batch.enabled` | `boolean` | `false` | 启用批量嵌入 API | +| `remote.batch.concurrency` | `number` | `2` | 并行批处理任务数 | +| `remote.batch.wait` | `boolean` | `true` | 等待批处理完成 | +| `remote.batch.pollIntervalMs` | `number` | -- | 轮询间隔 | +| `remote.batch.timeoutMinutes` | `number` | -- | 批处理超时时间 | -适用于 `openai`、`gemini` 和 `voyage`。对于大规模回填,OpenAI 批处理通常最快且最便宜。 +适用于 `openai`、`gemini` 和 `voyage`。对于大规模回填,OpenAI 批处理通常最快且成本最低。 + +这与 `sync.embeddingBatchTimeoutSeconds` 是分开的,后者控制本地/自托管提供商使用的内联嵌入调用,以及在未启用提供商批量 API 时托管提供商使用的内联嵌入调用。 --- -## 会话 memory 搜索(实验性) +## 会话内存搜索(实验性) -为会话 transcript 建立索引,并通过 `memory_search` 暴露: +为会话转录建立索引,并通过 `memory_search` 提供结果: -| Key | 类型 | 默认值 | 说明 | -| ----------------------------- | ---------- | ------------- | ----------------------------------------- | -| `experimental.sessionMemory` | `boolean` | `false` | 启用会话索引 | -| `sources` | `string[]` | `["memory"]` | 添加 `"sessions"` 以包含 transcripts | -| `sync.sessions.deltaBytes` | `number` | `100000` | 触发重新索引的字节阈值 | -| `sync.sessions.deltaMessages` | `number` | `50` | 触发重新索引的消息阈值 | +| 键 | 类型 | 默认值 | 说明 | +| ----------------------------- | ---------- | ------------ | --------------------------------------- | +| `experimental.sessionMemory` | `boolean` | `false` | 启用会话索引 | +| `sources` | `string[]` | `["memory"]` | 添加 `"sessions"` 以包含转录 | +| `sync.sessions.deltaBytes` | `number` | `100000` | 触发重建索引的字节阈值 | +| `sync.sessions.deltaMessages` | `number` | `50` | 触发重建索引的消息阈值 | -会话索引需要显式启用,并异步运行。结果可能会略有滞后。会话日志存储在磁盘上,因此应将文件系统访问视为信任边界。 +会话索引是选择启用的,并且会异步运行。结果可能会略有滞后。会话日志存储在磁盘上,因此请将文件系统访问视为信任边界。 --- ## SQLite 向量加速(sqlite-vec) -| Key | 类型 | 默认值 | 说明 | -| ---------------------------- | --------- | ------ | -------------------------------- | -| `store.vector.enabled` | `boolean` | `true` | 使用 sqlite-vec 执行向量查询 | -| `store.vector.extensionPath` | `string` | bundled | 覆盖 sqlite-vec 路径 | +| 键 | 类型 | 默认值 | 说明 | +| ---------------------------- | --------- | --------- | ----------------------------- | +| `store.vector.enabled` | `boolean` | `true` | 使用 sqlite-vec 执行向量查询 | +| `store.vector.extensionPath` | `string` | 内置 | 覆盖 sqlite-vec 路径 | 当 sqlite-vec 不可用时,OpenClaw 会自动回退到进程内余弦相似度计算。 @@ -365,10 +373,10 @@ openclaw memory index --force --agent main ## 索引存储 -| Key | 类型 | 默认值 | 说明 | -| --------------------- | -------- | ------------------------------------- | ------------------------------------ | -| `store.path` | `string` | `~/.openclaw/memory/{agentId}.sqlite` | 索引位置(支持 `{agentId}` token) | -| `store.fts.tokenizer` | `string` | `unicode61` | FTS5 tokenizer(`unicode61` 或 `trigram`) | +| 键 | 类型 | 默认值 | 说明 | +| --------------------- | -------- | ------------------------------------- | ------------------------------------- | +| `store.path` | `string` | `~/.openclaw/memory/{agentId}.sqlite` | 索引位置(支持 `{agentId}` 占位符) | +| `store.fts.tokenizer` | `string` | `unicode61` | FTS5 分词器(`unicode61` 或 `trigram`) | --- @@ -377,47 +385,47 @@ openclaw memory index --force --agent main 设置 `memory.backend = "qmd"` 以启用。所有 QMD 设置都位于 `memory.qmd` 下: -| Key | 类型 | 默认值 | 说明 | -| ------------------------ | --------- | -------- | ------------------------------------------- | -| `command` | `string` | `qmd` | QMD 可执行文件路径 | -| `searchMode` | `string` | `search` | 搜索命令:`search`、`vsearch`、`query` | -| `includeDefaultMemory` | `boolean` | `true` | 自动索引 `MEMORY.md` + `memory/**/*.md` | -| `paths[]` | `array` | -- | 额外路径:`{ name, path, pattern? }` | -| `sessions.enabled` | `boolean` | `false` | 为会话 transcript 建立索引 | -| `sessions.retentionDays` | `number` | -- | transcript 保留天数 | -| `sessions.exportDir` | `string` | -- | 导出目录 | +| 键 | 类型 | 默认值 | 说明 | +| ------------------------ | --------- | -------- | -------------------------------------------- | +| `command` | `string` | `qmd` | QMD 可执行文件路径 | +| `searchMode` | `string` | `search` | 搜索命令:`search`、`vsearch`、`query` | +| `includeDefaultMemory` | `boolean` | `true` | 自动索引 `MEMORY.md` + `memory/**/*.md` | +| `paths[]` | `array` | -- | 额外路径:`{ name, path, pattern? }` | +| `sessions.enabled` | `boolean` | `false` | 索引会话转录 | +| `sessions.retentionDays` | `number` | -- | 转录保留时长 | +| `sessions.exportDir` | `string` | -- | 导出目录 | -OpenClaw 优先使用当前 QMD collection 和 MCP 查询结构,但仍会通过回退到旧版 `--mask` collection 标志和较旧的 MCP 工具名称,来保持对旧版 QMD 发布的兼容性。 +OpenClaw 优先使用当前的 QMD collection 和 MCP 查询结构,但在需要时也会通过回退到旧版 `--mask` collection 标志和旧版 MCP 工具名称来兼容较老的 QMD 版本。 -QMD 模型覆盖保留在 QMD 一侧,而不是放在 OpenClaw 配置中。如果你需要全局覆盖 QMD 的模型,请在 Gateway 网关运行时环境中设置环境变量,例如 +QMD 模型覆盖保留在 QMD 侧,而不是放在 OpenClaw 配置中。如果你需要全局覆盖 QMD 的模型,请在 Gateway 网关 运行时环境中设置环境变量,例如 `QMD_EMBED_MODEL`、`QMD_RERANK_MODEL` 和 `QMD_GENERATE_MODEL`。 ### 更新计划 -| Key | 类型 | 默认值 | 说明 | -| ------------------------- | --------- | ------- | ---------------------------- | -| `update.interval` | `string` | `5m` | 刷新间隔 | -| `update.debounceMs` | `number` | `15000` | 文件变更去抖 | -| `update.onBoot` | `boolean` | `true` | 启动时刷新 | -| `update.waitForBootSync` | `boolean` | `false` | 启动时阻塞直到刷新完成 | -| `update.embedInterval` | `string` | -- | 单独的嵌入更新频率 | -| `update.commandTimeoutMs` | `number` | -- | QMD 命令超时 | -| `update.updateTimeoutMs` | `number` | -- | QMD 更新操作超时 | -| `update.embedTimeoutMs` | `number` | -- | QMD 嵌入操作超时 | +| 键 | 类型 | 默认值 | 说明 | +| ------------------------- | --------- | --------- | ------------------------------ | +| `update.interval` | `string` | `5m` | 刷新间隔 | +| `update.debounceMs` | `number` | `15000` | 文件变更防抖 | +| `update.onBoot` | `boolean` | `true` | 启动时刷新 | +| `update.waitForBootSync` | `boolean` | `false` | 阻塞启动直到刷新完成 | +| `update.embedInterval` | `string` | -- | 单独的嵌入执行周期 | +| `update.commandTimeoutMs` | `number` | -- | QMD 命令超时时间 | +| `update.updateTimeoutMs` | `number` | -- | QMD 更新操作超时时间 | +| `update.embedTimeoutMs` | `number` | -- | QMD 嵌入操作超时时间 | ### 限制 -| Key | 类型 | 默认值 | 说明 | -| ------------------------- | -------- | ------ | -------------------- | -| `limits.maxResults` | `number` | `6` | 最大搜索结果数 | -| `limits.maxSnippetChars` | `number` | -- | 限制 snippet 长度 | -| `limits.maxInjectedChars` | `number` | -- | 限制总注入字符数 | -| `limits.timeoutMs` | `number` | `4000` | 搜索超时 | +| 键 | 类型 | 默认值 | 说明 | +| ------------------------- | -------- | ------- | ------------------------ | +| `limits.maxResults` | `number` | `6` | 最大搜索结果数 | +| `limits.maxSnippetChars` | `number` | -- | 限制摘要片段长度 | +| `limits.maxInjectedChars` | `number` | -- | 限制注入的总字符数 | +| `limits.timeoutMs` | `number` | `4000` | 搜索超时时间 | -### 范围 +### 作用范围 -控制哪些会话可以接收 QMD 搜索结果。Schema 与 -[`session.sendPolicy`](/zh-CN/gateway/config-agents#session) 相同: +控制哪些会话可以接收 QMD 搜索结果。使用与 +[`session.sendPolicy`](/zh-CN/gateway/config-agents#session) 相同的 schema: ```json5 { @@ -432,20 +440,20 @@ QMD 模型覆盖保留在 QMD 一侧,而不是放在 OpenClaw 配置中。如 } ``` -随附的默认配置允许私信和渠道会话,同时仍拒绝群组。 +内置默认值允许私信和渠道会话,同时仍然拒绝群组。 -默认仅限私信。`match.keyPrefix` 匹配标准化后的会话键; +默认仅限私信。`match.keyPrefix` 匹配规范化后的会话键; `match.rawKeyPrefix` 匹配包含 `agent::` 的原始键。 ### 引用 `memory.citations` 适用于所有后端: -| 值 | 行为 | -| ---------------- | --------------------------------------------------- | -| `auto`(默认) | 在 snippet 中包含 `Source: ` 页脚 | -| `on` | 始终包含页脚 | -| `off` | 省略页脚(路径仍会在内部传递给智能体) | +| 值 | 行为 | +| ---------------- | ------------------------------------------------- | +| `auto`(默认) | 在摘要片段中包含 `Source: ` 页脚 | +| `on` | 始终包含页脚 | +| `off` | 省略页脚(路径仍会在内部传递给智能体) | ### 完整 QMD 示例 @@ -473,18 +481,18 @@ QMD 模型覆盖保留在 QMD 一侧,而不是放在 OpenClaw 配置中。如 ## Dreaming Dreaming 配置位于 `plugins.entries.memory-core.config.dreaming` 下, -而不是 `agents.defaults.memorySearch`。 +而不在 `agents.defaults.memorySearch` 下。 -Dreaming 作为一次计划性扫描运行,并将内部的浅层 / 深层 / REM 阶段作为实现细节使用。 +Dreaming 作为一次定时扫描运行,并将内部的 light/deep/REM 阶段作为实现细节使用。 -关于概念行为和斜杠命令,请参见 [Dreaming](/zh-CN/concepts/dreaming)。 +有关概念行为和斜杠命令,请参见 [Dreaming](/zh-CN/concepts/dreaming)。 ### 用户设置 -| Key | 类型 | 默认值 | 说明 | -| ----------- | --------- | ----------- | ------------------------------------ | -| `enabled` | `boolean` | `false` | 完全启用或禁用 Dreaming | -| `frequency` | `string` | `0 3 * * *` | 完整 Dreaming 扫描的可选 cron 频率 | +| 键 | 类型 | 默认值 | 说明 | +| ----------- | --------- | ----------- | ---------------------------------- | +| `enabled` | `boolean` | `false` | 完全启用或禁用 Dreaming | +| `frequency` | `string` | `0 3 * * *` | 完整 Dreaming 扫描的可选 cron 周期 | ### 示例 @@ -507,12 +515,12 @@ Dreaming 作为一次计划性扫描运行,并将内部的浅层 / 深层 / RE 说明: -- Dreaming 会将机器状态写入 `memory/.dreams/`。 -- Dreaming 会将人类可读的叙述性输出写入 `DREAMS.md`(或现有的 `dreams.md`)。 -- 浅层 / 深层 / REM 阶段策略和阈值属于内部行为,而不是面向用户的配置。 +- Dreaming 将机器状态写入 `memory/.dreams/`。 +- Dreaming 将人类可读的叙事输出写入 `DREAMS.md`(或现有的 `dreams.md`)。 +- light/deep/REM 阶段策略和阈值属于内部行为,不是面向用户的配置。 ## 相关内容 -- [Memory 概览](/zh-CN/concepts/memory) -- [Memory 搜索](/zh-CN/concepts/memory-search) -- [配置参考](/zh-CN/gateway/configuration-reference) +- [Memory overview](/zh-CN/concepts/memory) +- [Memory search](/zh-CN/concepts/memory-search) +- [Configuration reference](/zh-CN/gateway/configuration-reference)