> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeus.agentspro.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 处理文档

> 触发文档处理（异步）— 解析、分块、向量化

手动触发文档的后台处理流程：加载文件 → SmartChunker 智能分块 → Embedding 向量化 → 存储到 pgvector。

处理在 `BackgroundTasks` 中异步执行，状态通过 [获取文档详情](/zh/knowledge-base/api/get-document) 轮询。

### 状态机

| 当前状态                 | 行为             |
| -------------------- | -------------- |
| `pending` / `failed` | 启动后台处理任务       |
| `processing`         | 返回 `"文档正在处理中"` |
| `completed`          | 返回 `"文档已处理完成"` |

<ParamField header="Authorization" type="string" required>
  Bearer JWT Token
</ParamField>

<ParamField path="id" type="string" required>
  知识库 ID
</ParamField>

<ParamField path="docId" type="string" required>
  文档 ID
</ParamField>

<ResponseField name="message" type="string">
  操作结果消息
</ResponseField>

<ResponseField name="status" type="string">
  文档当前状态
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://zeus-api.agentspro.cn/api/knowledge-base/kb_abc123/documents/doc_xyz789/process \
    --header 'Authorization: Bearer <token>'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "message": "文档处理已启动",
    "status": "processing"
  }
  ```
</ResponseExample>
