Skip to main content
GET
获取文档的索引任务

Authorizations

Authorization
string
header
required

每个请求都通过 API Key 认证:Authorization: Bearer {API_KEY}。应用接口使用应用 API Key,知识库接口使用知识库 API Key(快速开始)。

API Key 应保存在服务端,切勿嵌入客户端代码。缺失或无效的 Key 会返回 HTTP 401(unauthorized)。

Path Parameters

knowledge_base_id
string<uuid>
required

知识库 ID:即知识库 API 访问 对话框中所示服务 API 端点的最后一段(…/knowledge-fs/spaces/<knowledge base ID>),也是地址栏中 /datasets/new/ 之后的那一段。

document_id
string<uuid>
required

文档 ID,从 获取文档列表 获取。

task_id
string<uuid>
required

索引任务 ID:获取文档 或 获取文档列表 返回的 latest_task.id,或 获取文档的索引任务列表 返回的 id。该任务必须属于此文档。

Response

索引任务。

active_operations
string[] | null

当前阶段正在进行的操作,例如 parse、chunk、embedding 或 publication。

completed_at
string | null

任务结束时间,ISO 8601 格式。运行期间为 null。

created_at
string

任务创建时间,ISO 8601 格式。获取索引任务 以 Unix 纪元毫秒返回同一任务的时间。

document_id
string

文档 ID。

document_revision
integer

此任务构建的修订版本。

error_code
string | null

state 为 failed 时的错误码。

error_message
string | null

error_code 对应的错误消息,可能与 failure.message 不同。

failure
object | null

state 为 failed 时的错误详情。其中 stage 为任务失败时所处的 phase,traceId 为任务 ID。其他情况下为 null。

id
string

索引任务 ID。同一 ID 可用于 获取索引任务、取消索引任务 和 重试索引任务。

knowledge_space_id
string

知识库的内部 ID,并非路径中的知识库 ID。

phase
string | null

任务当前执行的环节:queued、parsing、outline_summary、chunking_indexing、graph_admission、publication 或 complete。

progress_percent
integer

进度,取值 0~100,由 stage 推算。

retry_at
string | null

自动重试的时间,ISO 8601 格式。state 为 retry_wait 时设置。

semantic_enrichment
object | null

已索引内容的知识图谱构建状态。深度检索和研究检索会沿知识图谱进行。未安排构建时,任务运行期间 state 为 not_scheduled,任务结束后为 disabled。

stage
string

已到达的最后一个检查点,按推进顺序依次为:queued、parsed、outline_built、nodes_generated、projection_built、smoke_eval_passed、published。任务失败或取消时,该值停在最后到达的检查点,因此结果要看 state。

state
string

运行状态:

  • dispatch_pending、queued:等待工作进程处理。
  • retry_wait:已安排在 retry_at 自动重试。
  • running:工作进程正在索引。
  • succeeded:修订版本已发布,可响应查询。semantic_enrichment 可能仍在运行。
  • failed:详见 failure。可用 重试索引任务 重新启动。
  • canceled。
  • superseded:较新的一次尝试取代了本次尝试。

succeeded、failed、canceled 和 superseded 为终态。

updated_at
string

任务或其语义增强最后变更时间,ISO 8601 格式。