🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
📝 docs: Add memory feature environment variables documentation (#16567)
Sui_Fengf00885f61c23
diff --git a/docs/self-hosting/environment-variables/cloud-sandbox.mdx b/docs/self-hosting/environment-variables/cloud-sandbox.mdxindex f9418e95b01..4613d128904 100644--- a/docs/self-hosting/environment-variables/cloud-sandbox.mdx+++ b/docs/self-hosting/environment-variables/cloud-sandbox.mdx@@ -81,7 +81,7 @@ Supported values:- Type: Optional- Description: Lease duration for persistent terminal sessions created by the Cloud Sandbox provider.- Default: `900`-- Example: `3600`+- Example: `900`## Market Configurationdiff --git a/docs/self-hosting/environment-variables/cloud-sandbox.zh-CN.mdx b/docs/self-hosting/environment-variables/cloud-sandbox.zh-CN.mdxindex ff8c8310516..11d4110fd62 100644--- a/docs/self-hosting/environment-variables/cloud-sandbox.zh-CN.mdx+++ b/docs/self-hosting/environment-variables/cloud-sandbox.zh-CN.mdx@@ -79,7 +79,7 @@ tags:- 类型:可选- 描述:云端沙箱提供方创建持久终端会话时使用的租约时长。- 默认值:`900`-- 示例:`3600`+- 示例:`900`## Market 配置diff --git a/docs/self-hosting/environment-variables/memories.mdx b/docs/self-hosting/environment-variables/memories.mdxnew file mode 100644index 00000000000..161b0dc828a--- /dev/null+++ b/docs/self-hosting/environment-variables/memories.mdx@@ -0,0 +1,180 @@+---+title: Configure Memory Environment Variables+description: >-+ Learn how to configure the Gate Keeper, Layer Extractor, and Embedding+ environment variables required by LobeHub's memory feature.+tags:+ - Memory+ - Environment Variables+ - Embedding+---++# Configure Memory Environment Variables++LobeHub's memory feature relies on three independent model stages working together: the **Gate Keeper** decides whether conversation content is worth saving as a memory, the **Layer Extractor** extracts the actual memory content from the conversation context, and **Embedding** converts the extracted memory content into vectors to support semantic retrieval.++To fit different deployment scenarios, each of these three stages can be configured independently with its own model, provider, API endpoint, and API key. If left unconfigured, LobeHub falls back to the user's preferred model configured in the model provider settings.++## Gate Keeper++The Gate Keeper reviews content before it is written into memory, avoiding redundant or low-quality memories.++### `MEMORY_USER_MEMORY_GATEKEEPER_LANGUAGE`++- Type: Optional+- Description: Forces the language used for the Gate Keeper's output+- Default: -+- Example: `简体中文`++### `MEMORY_USER_MEMORY_GATEKEEPER_MODEL`++- Type: Optional+- Description: Forces the model used by the Gate Keeper, with priority higher than the provider and model preference settings+- Default: -+- Example: `gpt-5.4-mini`++### `MEMORY_USER_MEMORY_GATEKEEPER_API_KEY`++- Type: Optional+- Description: API key for the provider of the model used by the Gate Keeper+- Default: -+- Example: `sk-xxxxxx...xxxxxx`++### `MEMORY_USER_MEMORY_GATEKEEPER_BASE_URL`++- Type: Optional+- Description: Base URL of the API endpoint. If it is OpenAI-compatible, only the part up to `/v1` needs to be provided+- Default: -+- Example: `https://example.com/v1`++### `MEMORY_USER_MEMORY_GATEKEEPER_PROVIDER`++- Type: Optional+- Description: Selects which LobeHub-supported provider SDK implementation backs this model. If it is OpenAI-compatible, set it to `openai`+- Default: -+- Example: `openai`++### `MEMORY_USER_MEMORY_GATEKEEPER_PREFERRED_PROVIDERS`++- Type: Optional+- Description: When a user with memory enabled has configured multiple providers, this sets the matching order of providers, separated by commas+- Default: -+- Example: `openai,deepseek`++### `MEMORY_USER_MEMORY_GATEKEEPER_PREFERRED_MODELS`++- Type: Optional+- Description: When a user with memory enabled has configured multiple providers and activated multiple models, this sets the matching order of models. If no match is found, LobeHub falls through to the next model id. For example, if the OpenAI model on OpenRouter is identified as `openai/gpt-5.4-mini`, use that id here+- Default: -+- Example: `gpt-5.4-mini,openai/gpt-5.4-mini`++## Layer Extractor++The Layer Extractor extracts the specific content worth persisting as long-term memory from the conversation context.++### `MEMORY_USER_MEMORY_LAYER_EXTRACTOR_CONTEXT_LIMIT`++- Type: Optional+- Description: Token limit for the model's context. For example, if the model's context limit is `27200` tokens, it's recommended to set this to 60%~75% of that limit, leaving the rest of the budget for the generated content+- Default: -+- Example: `20000`++### `MEMORY_USER_MEMORY_LAYER_EXTRACTOR_MODEL`++- Type: Optional+- Description: Forces the model used by the Layer Extractor, with priority higher than the provider and model preference settings+- Default: -+- Example: `gpt-5.4-mini`++### `MEMORY_USER_MEMORY_LAYER_EXTRACTOR_API_KEY`++- Type: Optional+- Description: API key for the provider of the model used by the Layer Extractor+- Default: -+- Example: `sk-xxxxxx...xxxxxx`++### `MEMORY_USER_MEMORY_LAYER_EXTRACTOR_BASE_URL`++- Type: Optional+- Description: Base URL of the API endpoint. If it is OpenAI-compatible, only the part up to `/v1` needs to be provided+- Default: -+- Example: `https://example.com/v1`++### `MEMORY_USER_MEMORY_LAYER_EXTRACTOR_PROVIDER`++- Type: Optional+- Description: Selects which LobeHub-supported provider SDK implementation backs this model. If it is OpenAI-compatible, set it to `openai`+- Default: -+- Example: `openai`++### `MEMORY_USER_MEMORY_LAYER_EXTRACTOR_PREFERRED_PROVIDERS`++- Type: Optional+- Description: When a user with memory enabled has configured multiple providers, this sets the matching order of providers, separated by commas+- Default: -+- Example: `openai,deepseek`++### `MEMORY_USER_MEMORY_LAYER_EXTRACTOR_PREFERRED_MODELS`++- Type: Optional+- Description: When a user with memory enabled has configured multiple providers and activated multiple models, this sets the matching order of models. If no match is found, LobeHub falls through to the next model id+- Default: -+- Example: `gpt-5.4-mini,openai/gpt-5.4-mini`++## Embedding++Embedding converts the extracted memory content into vectors for subsequent semantic retrieval.++### `MEMORY_USER_MEMORY_EMBEDDING_CONTEXT_LIMIT`++- Type: Optional+- Description: Token limit for the embedding model. For example, if an OpenAI embedding model has a limit of `8192` tokens, it's recommended to set this to 75%~90% of that limit. You can set it higher when using an embedding model with a larger context window, such as Voyage+- Default: -+- Example: `5000`++### `MEMORY_USER_MEMORY_EMBEDDING_API_KEY`++- Type: Optional+- Description: API key for the provider of the model used for Embedding+- Default: -+- Example: `sk-xxxxxx...xxxxxx`++### `MEMORY_USER_MEMORY_EMBEDDING_BASE_URL`++- Type: Optional+- Description: Base URL of the API endpoint. If it is OpenAI-compatible, only the part up to `/v1` needs to be provided+- Default: -+- Example: `https://example.com/v1`++### `MEMORY_USER_MEMORY_EMBEDDING_MODEL`++- Type: Optional+- Description: Forces the model used for Embedding, with priority higher than the provider and model preference settings+- Default: -+- Example: `text-embedding-3-large`++<Callout type={'info'}>+ The example above uses OpenAI's `text-embedding-3-large` model. Replace it with the embedding+ model you actually intend to use.+</Callout>++### `MEMORY_USER_MEMORY_EMBEDDING_PROVIDER`++- Type: Optional+- Description: Selects which LobeHub-supported provider SDK implementation backs this model. If it is OpenAI-compatible, set it to `openai`+- Default: -+- Example: `openai`++### `MEMORY_USER_MEMORY_EMBEDDING_PREFERRED_PROVIDERS`++- Type: Optional+- Description: When a user with memory enabled has configured multiple providers, this sets the matching order of providers, separated by commas+- Default: -+- Example: `openai`++### `MEMORY_USER_MEMORY_EMBEDDING_PREFERRED_MODELS`++- Type: Optional+- Description: When a user with memory enabled has configured multiple providers and activated multiple models, this sets the matching order of models. If no match is found, LobeHub falls through to the next model id+- Default: -+- Example: `text-embedding-3-large,openai/text-embedding-3-large`\ No newline at end of filediff --git a/docs/self-hosting/environment-variables/memories.zh-CN.mdx b/docs/self-hosting/environment-variables/memories.zh-CN.mdxnew file mode 100644index 00000000000..5ff22cfb196--- /dev/null+++ b/docs/self-hosting/environment-variables/memories.zh-CN.mdx@@ -0,0 +1,178 @@+---+title: 配置记忆功能环境变量+description: 了解如何配置 LobeHub 记忆功能所需的过滤器、提取器和向量化模型相关环境变量。+tags:+ - 记忆+ - Memory+ - 环境变量+ - Embedding+---++# 配置记忆功能环境变量++LobeHub 的记忆功能依赖三个相互独立的模型环节协同工作:**过滤器(Gate Keeper)** 负责判断对话内容是否值得写入记忆,**提取器(Layer Extractor)** 负责从对话上下文中提取具体的记忆内容,**向量化(Embedding)** 负责将记忆内容转换为向量以支持语义检索。++为了适配不同的部署场景,这三个环节都支持单独配置模型、服务商、接口地址与 API Key。如果不配置,将回退使用用户在模型服务商设置中的偏好模型。++## 过滤器(Gate Keeper)++Gate Keeper 用于在写入记忆前对内容进行判断和把关,避免产生冗余或低质量的记忆。++### `MEMORY_USER_MEMORY_GATEKEEPER_LANGUAGE`++- 类型:可选+- 描述:强制指定 Gate Keeper 输出所使用的语言+- 默认值:-+- 示例:`简体中文`++### `MEMORY_USER_MEMORY_GATEKEEPER_MODEL`++- 类型:可选+- 描述:强制指定 Gate Keeper 使用的模型,优先级高于服务商和模型偏好设置+- 默认值:-+- 示例:`gpt-5.4-mini`++### `MEMORY_USER_MEMORY_GATEKEEPER_API_KEY`++- 类型:可选+- 描述:Gate Keeper 所使用模型对应服务商的 API Key+- 默认值:-+- 示例:`sk-xxxxxx...xxxxxx`++### `MEMORY_USER_MEMORY_GATEKEEPER_BASE_URL`++- 类型:可选+- 描述:接口的 Base URL。如果是 OpenAI 兼容接口,只需要填写到 `/v1` 的部分+- 默认值:-+- 示例:`https://example.com/v1`++### `MEMORY_USER_MEMORY_GATEKEEPER_PROVIDER`++- 类型:可选+- 描述:选择该模型背后使用的 LobeHub 支持的服务商 SDK 实现。如果是 OpenAI 兼容接口,填写 `openai` 即可+- 默认值:-+- 示例:`openai`++### `MEMORY_USER_MEMORY_GATEKEEPER_PREFERRED_PROVIDERS`++- 类型:可选+- 描述:当使用记忆功能的用户配置了多个服务商时,用于指定匹配服务商的顺序,多个服务商用英文逗号分隔+- 默认值:-+- 示例:`openai,deepseek`++### `MEMORY_USER_MEMORY_GATEKEEPER_PREFERRED_MODELS`++- 类型:可选+- 描述:当使用记忆功能的用户配置了多个服务商并激活了多个模型时,用于指定匹配模型的顺序;如果没有匹配到,将依次尝试下一个 model id。例如 OpenRouter 上的 OpenAI 模型 ID 为 `openai/gpt-5.4-mini`,此时应填写该 ID+- 默认值:-+- 示例:`gpt-5.4-mini,openai/gpt-5.4-mini`++## 提取器(Layer Extractor)++Layer Extractor 用于从对话上下文中提取出需要沉淀为长期记忆的具体内容。++### `MEMORY_USER_MEMORY_LAYER_EXTRACTOR_CONTEXT_LIMIT`++- 类型:可选+- 描述:模型的上下文 Token 限制。例如模型上下文限制为 `27200` Token 时,建议设置为该限制的 60%~75%,剩余部分预留给生成内容使用+- 默认值:-+- 示例:`20000`++### `MEMORY_USER_MEMORY_LAYER_EXTRACTOR_MODEL`++- 类型:可选+- 描述:强制指定 Layer Extractor 使用的模型,优先级高于服务商和模型偏好设置+- 默认值:-+- 示例:`gpt-5.4-mini`++### `MEMORY_USER_MEMORY_LAYER_EXTRACTOR_API_KEY`++- 类型:可选+- 描述:Layer Extractor 所使用模型对应服务商的 API Key+- 默认值:-+- 示例:`sk-xxxxxx...xxxxxx`++### `MEMORY_USER_MEMORY_LAYER_EXTRACTOR_BASE_URL`++- 类型:可选+- 描述:接口的 Base URL。如果是 OpenAI 兼容接口,只需要填写到 `/v1` 的部分+- 默认值:-+- 示例:`https://example.com/v1`++### `MEMORY_USER_MEMORY_LAYER_EXTRACTOR_PROVIDER`++- 类型:可选+- 描述:选择该模型背后使用的 LobeHub 支持的服务商 SDK 实现。如果是 OpenAI 兼容接口,填写 `openai` 即可+- 默认值:-+- 示例:`openai`++### `MEMORY_USER_MEMORY_LAYER_EXTRACTOR_PREFERRED_PROVIDERS`++- 类型:可选+- 描述:当使用记忆功能的用户配置了多个服务商时,用于指定匹配服务商的顺序,多个服务商用英文逗号分隔+- 默认值:-+- 示例:`openai,deepseek`++### `MEMORY_USER_MEMORY_LAYER_EXTRACTOR_PREFERRED_MODELS`++- 类型:可选+- 描述:当使用记忆功能的用户配置了多个服务商并激活了多个模型时,用于指定匹配模型的顺序;如果没有匹配到,将依次尝试下一个 model id+- 默认值:-+- 示例:`gpt-5.4-mini,openai/gpt-5.4-mini`++## 向量化(Embedding)++Embedding 用于将提取出的记忆内容转换为向量,以便后续进行语义检索。++### `MEMORY_USER_MEMORY_EMBEDDING_CONTEXT_LIMIT`++- 类型:可选+- 描述:Embedding 模型的 Token 限制。例如 OpenAI 的 Embedding 模型限制为 `8192` Token 时,建议设置为该限制的 75%~90%;如果使用 Voyage 等支持更大上下文的 Embedding 模型,可以设置得更高一些+- 默认值:-+- 示例:`5000`++### `MEMORY_USER_MEMORY_EMBEDDING_API_KEY`++- 类型:可选+- 描述:Embedding 所使用模型对应服务商的 API Key+- 默认值:-+- 示例:`sk-xxxxxx...xxxxxx`++### `MEMORY_USER_MEMORY_EMBEDDING_BASE_URL`++- 类型:可选+- 描述:接口的 Base URL。如果是 OpenAI 兼容接口,只需要填写到 `/v1` 的部分+- 默认值:-+- 示例:`https://example.com/v1`++### `MEMORY_USER_MEMORY_EMBEDDING_MODEL`++- 类型:可选+- 描述:强制指定 Embedding 使用的模型,优先级高于服务商和模型偏好设置+- 默认值:-+- 示例:`text-embedding-3-large`++<Callout type={'info'}>+ 以上示例以 OpenAI 的 `text-embedding-3-large` 模型为例,实际使用时请替换为你要使用的 Embedding 模型。+</Callout>++### `MEMORY_USER_MEMORY_EMBEDDING_PROVIDER`++- 类型:可选+- 描述:选择该模型背后使用的 LobeHub 支持的服务商 SDK 实现。如果是 OpenAI 兼容接口,填写 `openai` 即可+- 默认值:-+- 示例:`openai`++### `MEMORY_USER_MEMORY_EMBEDDING_PREFERRED_PROVIDERS`++- 类型:可选+- 描述:当使用记忆功能的用户配置了多个服务商时,用于指定匹配服务商的顺序,多个服务商用英文逗号分隔+- 默认值:-+- 示例:`openai`++### `MEMORY_USER_MEMORY_EMBEDDING_PREFERRED_MODELS`++- 类型:可选+- 描述:当使用记忆功能的用户配置了多个服务商并激活了多个模型时,用于指定匹配模型的顺序;如果没有匹配到,将依次尝试下一个 model id+- 默认值:-+- 示例:`text-embedding-3-large,openai/text-embedding-3-large`