术语表(中文译文)
原始 DeepWiki 页面:https://deepwiki.com/open-webui/open-webui/21-glossary
翻译时间:2026-06-09T16:12:54.480Z
翻译模型:deepseek-chat
原文字符数:23999
项目:Open WebUI (open-webui)
---
术语表
相关源文件
本 Wiki 页面的生成使用了以下文件作为上下文:
backend/open_webui/config.pybackend/open_webui/env.pybackend/open_webui/main.pybackend/open_webui/models/memories.pybackend/open_webui/retrieval/loaders/datalab_marker.pybackend/open_webui/retrieval/loaders/main.pybackend/open_webui/retrieval/loaders/mineru.pybackend/open_webui/retrieval/loaders/paddleocr_vl.pybackend/open_webui/retrieval/utils.pybackend/open_webui/routers/auths.pybackend/open_webui/routers/memories.pybackend/open_webui/routers/retrieval.pybackend/open_webui/tools/builtin.pybackend/open_webui/utils/auth.pybackend/open_webui/utils/middleware.pybackend/open_webui/utils/oauth.pybackend/open_webui/utils/tools.pysrc/lib/apis/index.tssrc/lib/apis/retrieval/index.tssrc/lib/components/admin/Settings/Documents.sveltesrc/lib/components/admin/Settings/WebSearch.sveltesrc/lib/components/workspace/Models/BuiltinTools.sveltesrc/lib/i18n/locales/ca-ES/translation.jsonsrc/lib/i18n/locales/de-DE/translation.jsonsrc/lib/i18n/locales/en-GB/translation.jsonsrc/lib/i18n/locales/en-US/translation.jsonsrc/lib/i18n/locales/es-ES/translation.jsonsrc/lib/i18n/locales/fa-IR/translation.jsonsrc/lib/i18n/locales/fr-CA/translation.jsonsrc/lib/i18n/locales/fr-FR/translation.jsonsrc/lib/i18n/locales/ru-RU/translation.jsonsrc/lib/i18n/locales/uk-UA/translation.jsonsrc/lib/i18n/locales/zh-CN/translation.jsonsrc/lib/i18n/locales/zh-TW/translation.jsonsrc/lib/stores/index.tssrc/routes/+layout.svelte
本术语表定义了 Open WebUI 项目中使用的代码库特定术语、行话和领域概念。它作为技术参考,帮助新入职的工程师理解底层实现和数据结构。
核心领域概念
PersistentConfig
一种同步系统,用于桥接环境变量、数据库设置和内存中的应用程序状态。它允许通过环境变量定义设置,但可以在运行时通过数据库覆盖并持久化,无需重启服务器。
- 实现:在
backend/open_webui/config.py中定义为泛型类PersistentConfig[T]。 - 数据流:初始化时,它会检查数据库中的
config表。如果存在值,则覆盖默认的环境变量值。 - 注册表:所有实例都在
PERSISTENT_CONFIG_REGISTRY中跟踪,以便在通过save_config更改数据库配置时进行批量更新。
配置同步流程
graph TD
subgraph "存储层"
[ENV_VAR] -->|["默认值"]| [PC_Instance]
[SQL_DB_config_table] -->|["覆盖值"]| [PC_Instance]
end
subgraph "逻辑空间"
[PC_Instance] -->|["注册"]| [PERSISTENT_CONFIG_REGISTRY]
[Admin_UI_Update] -->|["save_config"]| [SQL_DB_config_table]
[SQL_DB_config_table] -->|["触发更新"]| [PERSISTENT_CONFIG_REGISTRY]
[PERSISTENT_CONFIG_REGISTRY] -->|["刷新"]| [PC_Instance]
end
来源:backend/open_webui/config.py:214-231、backend/open_webui/config.py:152-158、backend/open_webui/config.py:175-189
消息历史树
Open WebUI 中的对话以树结构而非扁平列表存储。这支持分支(编辑较早的消息以启动新路径)和多模型响应(为单个父消息生成多个子消息)。
- 结构:数据库和前端存储中的每个消息对象都包含一个
parentId以及可能的子消息列表。 - 转换:前端将 API 返回的扁平数组转换为树结构,供 UI 在不同分支之间导航。
- 导航:
ResponseMessage.svelte等组件使用同级导航逻辑在不同模型响应或消息编辑之间切换。
来源:backend/open_webui/models/chats.py:125-126、backend/open_webui/utils/misc.py:87-102
技术术语与行话
入口与出口过滤器
pipelines 系统中的中间件组件,在聊天补全发送给 LLM(入口)之前或显示给用户(出口)之前拦截它们。
- 入口:用于提示注入、安全检查或添加上下文。
- 出口:用于 PII 擦除、响应格式化或引用标注。
- 执行:由后端中间件层中的
process_pipeline_inlet_filter和process_pipeline_outlet_filter处理。
来源:backend/open_webui/utils/middleware.py:55-58、backend/open_webui/utils/middleware.py:110-113
Valves
特定于工具、函数或过滤器的配置参数。与全局设置不同,Valves 的作用域限定于特定集成,用户或管理员可以通过 UI 进行配置。
- 全局 Valves:管理员为工具定义的设置(例如 API 密钥)。
- 用户 Valves:用户对工具的个性化偏好(例如特定的搜索过滤器)。
- 实现:通过后端的
Tools和Functions模型进行管理。
来源:backend/open_webui/utils/tools.py:202-208、backend/open_webui/models/tools.py:39-42
RAG(检索增强生成)
用于摄取文档并查询文档以向 LLM 提示提供上下文的系统。
- 嵌入函数(EF):将文本转换为向量的逻辑。由检索路由器中的
get_ef管理。 - 重排序函数(RF):根据与查询的相关性对搜索结果重新排序的逻辑。由
get_rf管理。 - 混合搜索:结合向量相似度与 BM25 关键词匹配,由
RAG_HYBRID_BM25_WEIGHT加权。
来源:backend/open_webui/routers/retrieval.py:139-159、backend/open_webui/routers/retrieval.py:162-206、backend/open_webui/routers/retrieval.py:262-262
自动化任务
允许 AI 运行定期操作(例如每日摘要)的定时任务。这些任务使用 iCalendar RRULE 语法进行调度。
- 引擎:由
automations路由器管理。 - 限制:管理员可以通过环境变量设置
AUTOMATION_MAX_COUNT和AUTOMATION_MIN_INTERVAL。
来源:backend/open_webui/main.py:107-107、backend/open_webui/utils/middleware.py:92-96
系统组件映射
下图将高级系统概念映射到代码库中的具体实现实体。
系统实体映射
graph LR
subgraph "自然语言空间"
[聊天会话]
[AI 模型]
[网络搜索]
[文档文件]
end
subgraph "代码实体空间"
[聊天会话] -->|编排| [layout_svelte]
[聊天会话] -->|持久化| [Chats_Model]
[AI 模型] -->|API 路由| [openai_router]
[AI 模型] -->|元数据| [Models_Model]
[网络搜索] -->|请求处理器| [retrieval_router]
[网络搜索] -->|搜索逻辑| [process_web_search]
[文档文件] -->|提取| [Loader_class]
[文档文件] -->|数据库存储| [Files_Model]
end
来源:src/routes/+layout.svelte:1-41、backend/open_webui/main.py:78-109、backend/open_webui/utils/middleware.py:30-32、backend/open_webui/retrieval/utils.py:91-124
关键缩写
| 缩写 | 完整术语 | 描述 | 代码指针 |
|---|---|---|---|
| TTS | 文本转语音 | 将 AI 响应转换为音频的系统。 | backend/open_webui/main.py:212-224 |
| STT | 语音转文本 | 将用户语音输入转换为文本的系统(Whisper 等)。 | backend/open_webui/main.py:199-211 |
| MCP | 模型上下文协议 | 将模型连接到工具/数据的标准。 | backend/open_webui/utils/middleware.py:117-117 |
| RAG | 检索增强生成 | 使用外部文档数据增强提示。 | backend/open_webui/routers/retrieval.py:84-95 |
| BM25 | 最佳匹配 25 | 混合检索中使用的排序函数。 | backend/open_webui/retrieval/utils.py:19-19 |
后端中间件管道
聊天补全的后端请求流涉及多个阶段的转换和工具执行。
聊天请求处理流程
sequenceDiagram
participant API as "FastAPI (main.py)"
participant MW as "中间件 (middleware.py)"
participant TC as "工具执行"
participant LLM as "LLM 提供商"
API->>MW: "process_chat_completion"
MW->>MW: "process_pipeline_inlet_filter"
MW->>TC: "get_tools"
TC-->>MW: "tool_definitions"
MW->>LLM: "generate_chat_completion"
LLM-->>MW: "tool_calls / content_stream"
alt 检测到工具调用
MW->>TC: "execute_tool_call"
TC-->>MW: "tool_result"
MW->>LLM: "使用工具结果重新调用"
end
MW->>MW: "process_pipeline_outlet_filter"
MW-->>API: "最终流式响应"
来源:backend/open_webui/utils/middleware.py:1-118、backend/open_webui/main.py:78-109
依赖类别
Open WebUI 依赖几个核心库来管理其复杂的功能集:
- Web 框架:
FastAPI驱动后端 APIbackend/open_webui/main.py:30-30。 - 前端框架:
Svelte和SvelteKit管理 UIsrc/routes/+layout.svelte:11-41。 - 数据库/ORM:
SQLAlchemy处理数据持久化和迁移backend/open_webui/config.py:18-39。 - 实时通信:
Socket.IO管理用于流式传输和事件的 WebSocketbackend/open_webui/main.py:69-77。 - 文档处理:多种引擎如
Tika、Docling和Marker用于文本提取backend/open_webui/retrieval/utils.py:91-124。 - 向量存储:通过
VECTOR_DB_CLIENT和ASYNC_VECTOR_DB_CLIENT抽象化backend/open_webui/routers/retrieval.py:47-48。
来源:backend/open_webui/config.py:1-40、backend/open_webui/main.py:1-109、backend/open_webui/retrieval/utils.py:1-56