feat: configure embedding servers and transcript agents

This commit is contained in:
yiling
2026-12-04 18:54:29 +08:00
parent 72a7f68c92
commit 553269012c
57 changed files with 1686 additions and 271 deletions
+8 -7
View File
@@ -99,13 +99,14 @@ Configures background worker execution, concurrency limits, and worker identity
## Embedding Config
| Variable | Description | Example / Default |
| :-------------------------------- | :------------------------------------------------------------------------------------------------------------ | :-------------------------------- |
| `EMBEDDING_PROVIDER` | Multimodal embedding provider. Options: `gemini-embedding-2`, `gemma-embedding-2-openai`. | `gemini-embedding-2` (default) |
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | Base URL of the OpenAI-compatible LiteRT-LM embedding server. | `http://embedding-server:9379/v1` |
| `ENABLE_EMBEDDING_AGENT` | When set to `true`, automatically provisions and enables the system embedding agent for all teams on startup. | `false` (default) |
| `EMBEDDING_CHUNK_DURATION` | The duration in seconds for each video chunk when generating video embeddings. | `60.0` (default) |
| `EMBEDDING_CHUNK_OVERLAP` | The duration in seconds to overlap video chunks when generating video embeddings. | `5.0` (default) |
| Variable | Description | Example / Default |
| :-------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------- |
| `EMBEDDING_PROVIDER` | Multimodal embedding provider. Options: `gemini-embedding-2`, `gemma-embedding-2-openai`. | `gemini-embedding-2` (default) |
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | Base URL of the OpenAI-compatible LiteRT-LM embedding server. | `http://embedding-server:9379/v1` |
| `ENABLE_EMBEDDING_AGENT` | When set to `true`, automatically provisions and enables the system embedding agent for all teams on startup. | `false` (default) |
| `ENABLE_TRANSCRIPTION_AGENT` | Set to `true` to provision and enable the Transcript Agent, or `false` to disable it. Either value makes it read-only in team settings. | Unset. Manage the agent in team settings. |
| `EMBEDDING_CHUNK_DURATION` | The duration in seconds for each video chunk when generating video embeddings. | `60.0` (default) |
| `EMBEDDING_CHUNK_OVERLAP` | The duration in seconds to overlap video chunks when generating video embeddings. | `5.0` (default) |
## Sandbox Config
+17 -7
View File
@@ -41,7 +41,7 @@ For video assets, Shumai breaks videos into standardized segments and extracts k
>
> If you change your embedding provider (for example, switching from Google Gemini's 1536-dimensional embeddings to EmbeddingGemma's 768-dimensional embeddings, or vice versa), **all existing vector embeddings in your database become invalid**.
>
> To protect production databases from accidental corruption and search failures, **Shumai intentionally does not provide a WebUI toggle to change the embedding provider**. The provider can only be configured by an administrator via environment variables (`EMBEDDING_PROVIDER` and `GEMMA_EMBEDDING_OPENAI_BASE_URL`).
> Saving an embedding server URL in Integrations selects EmbeddingGemma when `EMBEDDING_PROVIDER` is unset. Regenerate your embeddings after switching providers.
---
@@ -103,6 +103,7 @@ services:
EMBEDDING_PROVIDER: gemma-embedding-2-openai
GEMMA_EMBEDDING_OPENAI_BASE_URL: http://embedding-server:9379/v1
ENABLE_EMBEDDING_AGENT: 'true'
ENABLE_TRANSCRIPTION_AGENT: 'true'
CONCURRENCY_AGENT: 1
depends_on:
- embedding-server
@@ -111,14 +112,23 @@ services:
> [!NOTE]
> Since Shumai communicates with `embedding-server` over Docker's internal network, `embedding-server` does not need to expose any ports to the host machine.
### Configure in Shumai
Open **Team Settings → Integrations → Embedding Server**. Enter the URL as reached from Shumai, select **Test Connection**, and save. For Docker Compose, use the internal service address, such as `http://embedding-server:9379/v1`. Clear the field and save to remove the setting.
`EMBEDDING_PROVIDER` takes precedence over automatic provider selection. When `GEMMA_EMBEDDING_OPENAI_BASE_URL` is set, that URL takes precedence and the field is read-only. The embedding server accepts unauthenticated requests. [Embedding server source](https://github.com/shumaiOne/embedding-server/blob/main/serve.py)
Enable the **Embedding Agent** for semantic search. Enable the **Transcript Agent** for video transcription and internal comments on failed jobs. Both agents are available in **Team Settings → Agents**.
### Environment Variables
| Variable | Required | Description | Default |
| :-------------------------------- | :---------- | :---------------------------------------------------------------------------------------------------------------------------- | :------------------------- |
| `EMBEDDING_PROVIDER` | Yes | Set to `gemma-embedding-2-openai` to use the local LiteRT-LM server. | `gemini-embedding-2` |
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | Yes | HTTP base URL of the embedding server (e.g. `http://embedding-server:9379/v1`). | `http://localhost:9379/v1` |
| `ENABLE_EMBEDDING_AGENT` | No | Automatically provisions and enables the system embedding agent for all teams on startup. | `false` |
| `CONCURRENCY_AGENT` | Recommended | Maximum concurrent AI tasks executed by workers. **Set to `1`** when running `embedding-server` to prevent high memory usage. | `5` |
| Variable | Required | Description | Default |
| :-------------------------------- | :------------ | :----------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------- |
| `EMBEDDING_PROVIDER` | For env setup | Set to `gemma-embedding-2-openai` to use the local LiteRT-LM server. | `gemini-embedding-2` when no integration URL is saved |
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | No | Overrides the saved embedding server URL and makes the integration read-only. | `http://localhost:9379/v1` when the local provider is selected without a URL |
| `ENABLE_EMBEDDING_AGENT` | No | Automatically provisions and enables the system embedding agent for all teams on startup. | `false` |
| `ENABLE_TRANSCRIPTION_AGENT` | No | Set to `true` to create or enable the Transcript Agent, or `false` to disable it. Either value makes it read-only in Settings. | Unset. Manage the agent in Settings. |
| `CONCURRENCY_AGENT` | Recommended | Maximum concurrent AI tasks executed by workers. **Set to `1`** when running `embedding-server` to prevent high memory usage. | `5` |
---
+8 -7
View File
@@ -99,13 +99,14 @@ Shumai 支持配置可选的**归档存储**(冷存储)层级(`local` NAS/
## 向量模型配置
| 变量 | 说明 | 示例 / 默认值 |
| :-------------------------------- | :------------------------------------------------------------------------------- | :-------------------------------- |
| `EMBEDDING_PROVIDER` | 多模态向量模型服务商。可选值:`gemini-embedding-2`、`gemma-embedding-2-openai`。 | `gemini-embedding-2`(默认) |
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | 兼容 OpenAI 协议的 LiteRT-LM 向量模型服务 Base URL。 | `http://embedding-server:9379/v1` |
| `ENABLE_EMBEDDING_AGENT` | 设为 `true` 时,在启动时自动为所有团队置备并启用系统向量智能体。 | `false`(默认) |
| `EMBEDDING_CHUNK_DURATION` | 生成视频向量时每个视频切片的时长(单位:秒)。 | `60.0`(默认) |
| `EMBEDDING_CHUNK_OVERLAP` | 生成视频向量时各个视频切片的重叠时长(单位:秒)。 | `5.0`(默认) |
| 变量 | 说明 | 示例 / 默认值 |
| :-------------------------------- | :-------------------------------------------------------------------------------------------- | :-------------------------------- |
| `EMBEDDING_PROVIDER` | 多模态向量模型服务商。可选值:`gemini-embedding-2`、`gemma-embedding-2-openai`。 | `gemini-embedding-2`(默认) |
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | 兼容 OpenAI 协议的 LiteRT-LM 向量模型服务 Base URL。 | `http://embedding-server:9379/v1` |
| `ENABLE_TRANSCRIPTION_AGENT` | 设置为 `true` 时自动创建并启用转录智能体,设置为 `false` 时停用。两种情况下团队设置均为只读。 | 未设置时可在团队设置中管理。 |
| `ENABLE_EMBEDDING_AGENT` | 设为 `true` 时,在启动时自动为所有团队置备并启用系统向量智能体。 | `false`(默认) |
| `EMBEDDING_CHUNK_DURATION` | 生成视频向量时每个视频切片的时长(单位:秒)。 | `60.0`(默认) |
| `EMBEDDING_CHUNK_OVERLAP` | 生成视频向量时各个视频切片的重叠时长(单位:秒)。 | `5.0`(默认) |
## 沙箱配置
+17 -7
View File
@@ -41,7 +41,7 @@ Shumai 支持通过 [shumaiOne/embedding-server](https://github.com/shumaiOne/em
>
> 若更换向量服务提供商(例如从 Google Gemini 的 1536 维向量切换到 EmbeddingGemma 的 768 维向量,反之亦然),**数据库中现存的所有向量嵌入数据将全部失效**。
>
> 为保护生产数据库免受误操作损坏及搜索失效,**Shumai 刻意未在 Web 界面中提供切换 Embedding 提供商的开关**。该配置仅能由管理员通过环境变量(`EMBEDDING_PROVIDER` 和 `GEMMA_EMBEDDING_OPENAI_BASE_URL`)进行配置。
> 未设置 `EMBEDDING_PROVIDER` 时,在集成页面保存向量模型服务地址会启用 EmbeddingGemma。切换向量模型服务后,请重新生成向量。
---
@@ -103,6 +103,7 @@ services:
EMBEDDING_PROVIDER: gemma-embedding-2-openai
GEMMA_EMBEDDING_OPENAI_BASE_URL: http://embedding-server:9379/v1
ENABLE_EMBEDDING_AGENT: 'true'
ENABLE_TRANSCRIPTION_AGENT: 'true'
CONCURRENCY_AGENT: 1
depends_on:
- embedding-server
@@ -111,14 +112,23 @@ services:
> [!NOTE]
> 由于 Shumai 与 `embedding-server` 在 Docker 内部网络中通信,`embedding-server` 无需向宿主机映射暴露端口。
### 在 Shumai 中配置
打开 **团队设置 → 集成 → 向量模型服务**。输入 Shumai 可以访问的服务地址,选择 **测试连接**,然后保存。使用 Docker Compose 时,可填写内部服务地址,例如 `http://embedding-server:9379/v1`。清空地址并保存即可移除配置。
已设置的 `EMBEDDING_PROVIDER` 优先于自动选择。设置 `GEMMA_EMBEDDING_OPENAI_BASE_URL` 后,环境变量中的地址优先生效,集成页面的地址字段为只读。向量模型服务接受未经身份验证的请求。[向量模型服务源码](https://github.com/shumaiOne/embedding-server/blob/main/serve.py)
在 **团队设置 → 智能体** 中启用 **嵌入智能体** 后可使用语义搜索。启用 **转录智能体** 后可生成视频转录,转录失败时会在视频中发布内部评论。
### 环境变量
| 变量 | 必填 | 说明 | 默认值 |
| :-------------------------------- | :------- | :------------------------------------------------------------------------------------------------ | :------------------------- |
| `EMBEDDING_PROVIDER` | 是 | 设置为 `gemma-embedding-2-openai` 以使用本地 LiteRT-LM 服务。 | `gemini-embedding-2` |
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | 是 | 向量模型服务的 HTTP 基础地址(例如 `http://embedding-server:9379/v1`)。 | `http://localhost:9379/v1` |
| `ENABLE_EMBEDDING_AGENT` | 否 | 启动时自动为所有团队初始化并启用系统级向量嵌入智能体。 | `false` |
| `CONCURRENCY_AGENT` | 推荐配置 | Worker 执行 AI 任务的最大并发数。运行 `embedding-server` 时**务必设为 `1`**,以防止内存开销过大。 | `5` |
| 变量 | 必填 | 说明 | 默认值 |
| :-------------------------------- | :----------------- | :------------------------------------------------------------------------------------------------ | :---------------------------------------------------------- |
| `EMBEDDING_PROVIDER` | 环境变量配置时需要 | 设置为 `gemma-embedding-2-openai` 以使用本地 LiteRT-LM 服务。 | 未保存服务地址时为 `gemini-embedding-2` |
| `GEMMA_EMBEDDING_OPENAI_BASE_URL` | 否 | 覆盖集成页面保存的服务地址,并将地址字段设为只读。 | 选择本地模型服务且未配置地址时为 `http://localhost:9379/v1` |
| `ENABLE_EMBEDDING_AGENT` | 否 | 启动时自动为所有团队初始化并启用系统级向量嵌入智能体。 | `false` |
| `ENABLE_TRANSCRIPTION_AGENT` | 否 | `true` 会创建或启用转录智能体,`false` 会停用它。两种情况下设置页面均为只读。 | 未设置时可在设置页面管理。 |
| `CONCURRENCY_AGENT` | 推荐配置 | Worker 执行 AI 任务的最大并发数。运行 `embedding-server` 时**务必设为 `1`**,以防止内存开销过大。 | `5` |
---