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

# 查询生成任务状态

> 获取生成任务的当前状态。

## GET /generate/{jobId}

返回指定生成任务的当前状态，可用于轮询进行中的任务或查看已完成任务的详情。

### 路径参数

<ParamField path="jobId" type="string" required>
  要查询的生成任务 ID。
</ParamField>

### 响应

<ResponseField name="id" type="string">
  生成任务唯一标识。
</ResponseField>

<ResponseField name="siteId" type="string">
  关联站点 ID。
</ResponseField>

<ResponseField name="status" type="string">
  当前状态：`pending`、`processing`、`completed` 或 `failed`。
</ResponseField>

<ResponseField name="progress" type="number">
  进度百分比（0–100）。
</ResponseField>

<ResponseField name="url" type="string">
  生成所针对的 URL。
</ResponseField>

<ResponseField name="options" type="object">
  使用的生成选项。

  <Expandable title="options 字段">
    <ResponseField name="maxUrls" type="number">
      最大处理 URL 数。
    </ResponseField>

    <ResponseField name="showFullText" type="boolean">
      是否包含全文。
    </ResponseField>

    <ResponseField name="generationMethod" type="string">
      使用的方式：`simple` 或 `enhanced`。
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="fileUrl" type="string">
  生成文件的访问地址（完成时）。
</ResponseField>

<ResponseField name="fullTextUrl" type="string">
  全文版地址（完成时）。
</ResponseField>

<ResponseField name="error" type="string">
  失败时的错误信息。
</ResponseField>

<ResponseField name="createdAt" type="string">
  创建时间（ISO 8601）。
</ResponseField>

<ResponseField name="completedAt" type="string">
  完成时间（ISO 8601）。
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET https://api.llmgenerator.com/api/v1/generate/550e8400-e29b-41d4-a716-446655440000 \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.llmgenerator.com/api/v1/generate/550e8400-e29b-41d4-a716-446655440000',
    {
      headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
    }
  );

  const status = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json Processing theme={null}
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "siteId": "site_abc123",
    "status": "processing",
    "progress": 45,
    "url": "https://example.com",
    "options": {
      "maxUrls": 50,
      "showFullText": true,
      "generationMethod": "enhanced"
    },
    "fileUrl": null,
    "fullTextUrl": null,
    "error": null,
    "createdAt": "2026-01-20T10:00:00.000Z",
    "completedAt": null
  }
  ```

  ```json Completed theme={null}
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "siteId": "site_abc123",
    "status": "completed",
    "progress": 100,
    "url": "https://example.com",
    "options": {
      "maxUrls": 50,
      "showFullText": true,
      "generationMethod": "enhanced"
    },
    "fileUrl": "https://api.llmgenerator.com/api/v1/file/site_abc123",
    "fullTextUrl": "https://api.llmgenerator.com/api/v1/file/site_abc123?full=true",
    "error": null,
    "createdAt": "2026-01-20T10:00:00.000Z",
    "completedAt": "2026-01-20T10:05:00.000Z"
  }
  ```

  ```json Failed theme={null}
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "siteId": "site_abc123",
    "status": "failed",
    "progress": 0,
    "url": "https://example.com",
    "options": {
      "maxUrls": 50,
      "showFullText": false,
      "generationMethod": "simple"
    },
    "fileUrl": null,
    "fullTextUrl": null,
    "error": "Failed to fetch sitemap: 404 Not Found",
    "createdAt": "2026-01-20T10:00:00.000Z",
    "completedAt": "2026-01-20T10:00:30.000Z"
  }
  ```
</ResponseExample>
