# 更新知識版本

此 API 用於更新指定 Fileset 所包含的檔案清單（file_ids）。

你可以透過此操作，**完全取代**原有 Fileset 中的檔案以及 Metadata。

**備註：**

- **僅可更新尚未 Commit 的 Fileset**

- 一旦該 Fileset 已提交為知識版本（Committed），其內容即無法再修改，如需變更，請建立新的 Fileset 並重新 Commit

```javascript
curl -X 'PUT' \
  'http://127.0.0.1:8000/v1/filesets/{fileset_id}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer a7d54e9171b5d1095f9fb59e' \
  -H 'Content-Type: application/json' \
  -d '{
    "file_ids": [
      "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "8871d153-e495-41a0-a862-289095802781"
    ],
    "metadata": {
      "tag": ["policy", "operation", "draft"]
    },
    "name": "Company Policy Files v2.0"
  }'
```

#### Request Headers

| **Key** | **Value** |
| --- | --- |
| Request Method | PUT |
| accept | application/json |
| Authorization | Bearer &lt;your-api-key> |
| Content-Type | application/json |

#### Query Parameters

| **Field** | **Type** | **Note** | **Required** |
| --- | --- | --- | --- |
| fileset_id | string | uuid | true |

#### Request Payload

```javascript
{
  "file_ids": [
    "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "8871d153-e495-41a0-a862-289095802781"
  ],
  "metadata": {
    "tag": ["policy", "operation", "draft"]
  },
  "name": "Company Policy Files v2.0"
}
```

**Field Explanation**

| **Field** | **Type** | **Detail** | **Required** |
| --- | --- | --- | --- |
| file_ids | array | File ID 列表 | true |
| metadata | string | object，使用者自訂的描述資訊 | true |
| name | string | Fileset 的名稱 | true |

#### Response Body

```javascript
{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "name": "Company Policy Files v2.0",
  "object": "fileset",
  "metadata": {
    "parsing_mode": "HQ",
    "embedding_model": "apmic-embedding-v1",
    "fail_reason": null,
    "fail_detail": {},
    "tag": ["policy", "operation", "draft"]
  },
  "state": "draft",
  "created_at": "2025-01-01T00:00:00.000Z",
  "committed_at": null,
  "updated_at": "2025-01-01T00:05:00.000Z",
  "file_counts": {
    "draft": 1,
    "queued": 0,
    "processing": 0,
    "completed": 0,
    "failed": 0,
    "total": 1
  }
}
```

**Field Explanation**

回傳 「知識版本物件」章節列表內容。
