agentic_huge_data_base / wiki
页面 Onyx · 14 术语表·DeepWiki 中文全文译文

14 · 术语表(Glossary)

企业连接器与统一搜索 · 聚焦本章的模块关系、源码依据与实现要点。

项目Onyx 章节14 状态全文译文 模块文档对象与元数据、工作流与编排、智能体运行时、安装与启动
源码线索
  • CONTRIBUTING.md
  • README.md
  • README.zh-CN.md
  • backend/alembic/README.md
  • backend/alembic/versions/6a804aeb4830_duplicated_no_harm_user_file_migration.py
  • backend/alembic/versions/74379b447d4c_add_paste_as_tile_to_user.py
  • backend/alembic/versions/9aadf32dfeb4_add_user_files.py
  • backend/alembic_tenants/versions/3b45e0018bf1_add_new_available_tenant_table.py
  • backend/ee/onyx/background/celery/apps/primary.py
  • backend/ee/onyx/background/celery/tasks/beat_schedule.py
模块标签
  • 文档对象与元数据
  • 工作流与编排
  • 智能体运行时
  • 安装与启动
  • 测试、发布与运维

章节正文

术语表

词汇表

相关源文件

本章引用的主要源码文件:

  • CONTRIBUTING.md
  • README.md
  • README.zh-CN.md
  • backend/alembic/README.md
  • backend/alembic/versions/6a804aeb4830_duplicated_no_harm_user_file_migration.py
  • backend/alembic/versions/74379b447d4c_add_paste_as_tile_to_user.py
  • backend/alembic/versions/9aadf32dfeb4_add_user_files.py
  • backend/alembic_tenants/versions/3b45e0018bf1_add_new_available_tenant_table.py
  • backend/ee/onyx/background/celery/apps/primary.py
  • backend/ee/onyx/background/celery/tasks/beat_schedule.py
  • backend/ee/onyx/background/celery/tasks/tenant_provisioning/tasks.py
  • backend/ee/onyx/server/tenants/schema_management.py
  • backend/onyx/auth/schemas.py
  • backend/onyx/auth/users.py
  • backend/onyx/background/celery/apps/app_base.py
  • backend/onyx/background/celery/apps/beat.py
  • backend/onyx/background/celery/apps/heavy.py
  • backend/onyx/background/celery/apps/light.py
  • backend/onyx/background/celery/apps/monitoring.py
  • backend/onyx/background/celery/apps/primary.py
  • backend/onyx/background/celery/tasks/beat_schedule.py
  • backend/onyx/background/celery/tasks/shared/tasks.py
  • backend/onyx/background/celery/tasks/vespa/tasks.py
  • backend/onyx/chat/chat_state.py
  • backend/onyx/chat/chat_utils.py
  • backend/onyx/chat/llm_loop.py
  • backend/onyx/chat/llm_step.py
  • backend/onyx/chat/models.py
  • backend/onyx/chat/process_message.py
  • backend/onyx/chat/prompt_utils.py
  • backend/onyx/configs/app_configs.py
  • backend/onyx/configs/constants.py
  • backend/onyx/connectors/README.md
  • backend/onyx/connectors/factory.py
  • backend/onyx/context/search/models.py
  • backend/onyx/context/search/pipeline.py
  • backend/onyx/db/chat.py
  • backend/onyx/db/enums.py
  • backend/onyx/db/models.py
  • backend/onyx/db/tag.py
  • backend/onyx/db/user_preferences.py
  • backend/onyx/deep_research/dr_loop.py
  • backend/onyx/document_index/factory.py
  • backend/onyx/prompts/chat_prompts.py
  • backend/onyx/prompts/deep_research/__init__.py
  • backend/onyx/prompts/deep_research/dr_tool_prompts.py
  • backend/onyx/prompts/deep_research/orchestration_layer.py
  • backend/onyx/prompts/deep_research/research_agent.py
  • backend/onyx/prompts/prompt_utils.py
  • backend/onyx/prompts/tool_prompts.py
  • backend/onyx/redis/redis_pool.py
  • backend/onyx/server/features/build/db/sandbox.py
  • backend/onyx/server/manage/get_state.py
  • backend/onyx/server/manage/models.py
  • backend/onyx/server/manage/users.py
  • backend/onyx/server/query_and_chat/chat_backend.py
  • backend/onyx/server/query_and_chat/models.py
  • backend/onyx/tools/fake_tools/research_agent.py
  • backend/onyx/tools/models.py
  • backend/onyx/tools/tool_implementations/search/search_tool.py
  • backend/onyx/tools/tool_runner.py
  • backend/scripts/dev_run_background_jobs.py
  • backend/supervisord.conf
  • backend/tests/api/test_api.py
  • backend/tests/external_dependency_unit/db/test_tag_race_condition.py
  • backend/tests/external_dependency_unit/redis/test_tenant_redis.py
  • backend/tests/integration/multitenant_tests/tenants/test_tenant_provisioning_rollback.py
  • backend/tests/integration/tests/indexing/file_connector/test_files/.onyx_metadata.json
  • backend/tests/unit/ee/onyx/server/tenants/test_schema_management.py
  • backend/tests/unit/onyx/auth/test_single_tenant_jwt_strategy.py
  • backend/tests/unit/onyx/background/celery/tasks/tenant_provisioning/__init__.py
  • backend/tests/unit/onyx/background/celery/tasks/tenant_provisioning/test_check_available_tenants.py
  • backend/tests/unit/onyx/chat/test_llm_loop.py
  • backend/tests/unit/onyx/chat/test_llm_step.py
  • backend/tests/unit/onyx/server/test_upload_files.py
  • deployment/README.md
  • deployment/aws_ecs_fargate/cloudformation/services/onyx_nginx_service_template.yaml
  • deployment/aws_ecs_fargate/cloudformation/services/onyx_web_server_service_template.yaml
  • deployment/docker_compose/README.md
  • [web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx](web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx)
  • [web/src/app/admin/connectors/[connector]/pages/Advanced.tsx](web/src/app/admin/connectors/[connector]/pages/Advanced.tsx)
  • [web/src/app/admin/connectors/[connector]/pages/ConnectorInput/FileInput.tsx](web/src/app/admin/connectors/[connector]/pages/ConnectorInput/FileInput.tsx)
  • [web/src/app/admin/connectors/[connector]/pages/DynamicConnectorCreationForm.tsx](web/src/app/admin/connectors/[connector]/pages/DynamicConnectorCreationForm.tsx)
  • [web/src/app/admin/connectors/[connector]/pages/utils/google_site.ts](web/src/app/admin/connectors/[connector]/pages/utils/google_site.ts)
  • web/src/app/admin/indexing/status/CCPairIndexingStatusTable.tsx
  • web/src/app/admin/layout.tsx
  • web/src/components/admin/connectors/AccessTypeForm.tsx
  • web/src/components/admin/connectors/AccessTypeGroupSelector.tsx
  • web/src/components/icons/icons.tsx
  • web/src/hooks/useTokenRefresh.test.tsx
  • web/src/hooks/useTokenRefresh.ts
  • web/src/lib/connectors/connectors.tsx
  • web/src/lib/connectors/credentials.ts
  • web/src/lib/sources.ts
  • web/src/lib/types.ts
  • web/src/providers/UserProvider.tsx

本页面提供了 Onyx 代码库中特定术语、领域概念和架构模式的技术定义。它作为工程师的参考手册,将高层术语映射到代码中的具体实现细节。

核心领域实体

CCPair(连接器-凭证对)

CCPair 代表数据源连接的一个具体实例。它将 Connector("如何"和"何处",例如一个特定的 GitHub 仓库 URL)与 Credential("谁",例如一个个人访问令牌)绑定在一起。大多数索引和剪枝逻辑都在 CCPair 级别上操作。

  • 实现ConnectorCredentialPair backend/onyx/db/models.py:541-594
  • 状态跟踪:通过 ConnectorCredentialPairStatus backend/onyx/db/enums.py:64 进行跟踪。
  • 默认 ID:系统使用 DEFAULT_CC_PAIR_ID backend/onyx/configs/constants.py:74 定义的默认 ID 进行初始化。
Persona(助手)

Persona 是一个配置对象,定义了 LLM 的行为方式。它包含系统提示词、一组可用工具以及它可以访问的特定文档集或项目。在前端,这些通常被称为助手

  • 实现Persona backend/onyx/db/models.py:1010-1110
  • 默认 Persona:系统默认值(ID 0)由 DEFAULT_PERSONA_ID backend/onyx/configs/constants.py:72 定义。
文档集

跨不同连接器的文档的逻辑分组。可以将 Persona 限制为仅搜索特定的文档集。

  • 实现DocumentSet backend/onyx/db/models.py:740-762
用户角色

Onyx 实现了在前端和后端中定义的分层 RBAC 系统。

  • 角色limitedbasicadmincuratorglobal_curatorext_perm_userslack_user web/src/lib/types.ts:65-73
  • 后端定义UserRole backend/onyx/auth/schemas.py:47

聊天与编排术语

LLM 循环

run_llm_loop 是核心编排函数。它管理一个多周期执行过程,在此过程中 LLM 可以生成文本或调用工具。它处理 run_llm_steprun_tool_calls 之间的转换。

  • 关键函数run_llm_loop backend/onyx/chat/llm_loop.py:39
  • 周期限制:编排通常会限制周期以防止无限循环,特别是在深度研究中,可能涉及多达 6 个周期 backend/onyx/deep_research/dr_loop.py:95
深度研究模式

一种高级的多阶段编排流程,包括澄清、研究计划生成以及使用 research_agent 等专用工具的研究代理循环。

  • 入口点run_deep_research_llm_loop backend/onyx/deep_research/dr_loop.py:83
  • 编排器提示词ORCHESTRATOR_PROMPT backend/onyx/prompts/deep_research/orchestration_layer.py:47
数据包

流式 API 中的通信单元。数据包表示增量更新,例如 Token、工具调用开始或引用。

  • 实现Packet backend/onyx/server/query_and_chat/streaming_models.py:121
代码实体映射:从聊天请求到 LLM

下图说明了用户请求如何从 API 流经编排层到达 LLM。

标题:消息处理流程

Onyx · 代码实体映射:从聊天请求到 LLM · 图 1
Onyx · 代码实体映射:从聊天请求到 LLM · 图 1

来源:backend/onyx/chat/process_message.py:33backend/onyx/chat/llm_loop.py:39backend/onyx/chat/chat_state.py:24backend/onyx/chat/emitter.py:37

后台基础设施

Celery 工作节点

Onyx 使用专门的 Celery 队列来分离关注点并管理资源分配:

  • docfetching:用于从连接器拉取数据的高延迟网络任务 backend/onyx/configs/constants.py:89
  • docprocessing:用于解析和片段切分的 CPU 密集型任务 backend/onyx/configs/constants.py:88
  • indexing:用于嵌入向量生成和向量数据库写入的重型任务 backend/onyx/configs/constants.py:83
  • monitoring:用于检查后台进程健康状态的任务 backend/onyx/configs/constants.py:92
  • 实现:工作节点类型通过 OnyxCeleryQueues backend/onyx/background/celery/tasks/beat_schedule.py:17 定义。
Redis 栅栏

一种协调模式,用于确保在分布式系统中,特定任务(例如特定 CCPair 的索引)的同一实例一次只运行一个。

  • 实现set_fence backend/onyx/chat/stop_signal_checker.py:35
  • 超时时间CELERY_TASK_WAIT_FOR_FENCE_TIMEOUT backend/onyx/configs/constants.py:156

技术缩写

缩写完整术语定义代码指针
MT多租户允许在一个实例上隔离多个客户的架构。MULTI_TENANT shared_configs/configs.py:134
PAT个人访问令牌用于程序化 API 访问的用户生成令牌。fetch_user_for_pat backend/onyx/db/pat.py:130
OIDCOpenID Connect基于 OAuth 2.0 的认证层。AuthType.OIDC backend/onyx/configs/constants.py:107
SWRStale-While-Revalidate用于前端数据获取的 React 钩子库。useSWRweb/src/lib/hooks.ts:14
MCP模型上下文协议用于 LLM 访问外部工具/数据的协议。MCPServerStatus backend/onyx/db/enums.py:77

连接器与索引概念

索引管线

将原始数据转换为可搜索片段的步骤序列。

  1. 获取Connector 通过 load_from_statepoll 检索数据。
  2. 解析:从各种格式中提取文本(例如,使用 markitdown)。
  3. 切分:使用 Chunker 将文本拆分为可管理的片段。
  4. 嵌入:使用 indexing_model_server 生成向量。
  5. 更新插入:存储在 VespaOpenSearch 中。
  • 核心逻辑indexing_pipeline.py backend/onyx/indexing/indexing_pipeline.py
剪枝

从索引中移除源系统中不再存在的文档的过程。

  • 任务connector_pruning_generator_task backend/onyx/background/celery/tasks/pruning/tasks.py
  • 锁超时时间CELERY_PRUNING_LOCK_TIMEOUT backend/onyx/configs/constants.py:160
代码实体映射:数据入库

此图将概念上的入库管线映射到后端中的特定类和函数。

标题:文档入库管线

Onyx · 代码实体映射:数据入库 · 图 2
Onyx · 代码实体映射:数据入库 · 图 2

来源:backend/onyx/indexing/indexing_pipeline.pybackend/onyx/document_index/factory.py:84backend/onyx/db/models.py:118

数据库模型参考

模型名称用途文件路径
User存储用户身份、角色和偏好。backend/onyx/db/models.py:255
ChatSession对话线程的根实体。backend/onyx/db/models.py:1183
ChatMessage会话中的单个消息。backend/onyx/db/models.py:1288
Document已索引项目的元数据和主键。backend/onyx/db/models.py:612
ToolCallLLM 请求执行工具的记录。backend/onyx/db/models.py:1515
Connector数据源的配置。backend/onyx/db/models.py:476
Credential连接器的认证详情。backend/onyx/db/models.py:433
AccessToken用于认证的会话令牌存储。backend/onyx/db/models.py:365

来源:backend/onyx/db/models.pybackend/onyx/configs/constants.pyweb/src/lib/types.tsbackend/onyx/chat/llm_loop.pybackend/onyx/deep_research/dr_loop.py