# 新增知識版本

此 API 用於建立一個新的 **Fileset**，作為後續知識組織與查詢的單位。

開發者可以指定該 Fileset 的 Metadata 以及要包含的檔案 ID 清單（file_ids）。

```javascript
curl -X 'POST' \
  'http://127.0.0.1:8000/v1/filesets' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <your-api-key>' \
  -H 'Content-Type: application/json' \
  -d '{
    "file_ids": [
      "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    ],
    "metadata": {
      "from": "swagger"
    },
    "name": "Company Policy Files v1.0"
  }'
```

#### Request Headers

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

#### Request Payload

```javascript
{
  "file_ids": [
    "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  ],
  "metadata": {
    "tag": ["policy", "operation"]
  },
  "name": "Company Policy Files v1.0"
}
```

**Field Explanation**

| **Field** | **Type** | **Detail** | **Required** |
| --- | --- | --- | --- |
| file_ids | array | File ID 列表 | true |
| metadata | string | object，使用者自訂的描述資訊 | false |
| name | string | Fileset 的名稱，若沒指定系統會自動產生，格式為 fileset_YYYYMMDD_hh:mm | false |

#### Response Body

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

**Field Explanation**

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