匯入 Agent 版本
匯入 Agent 版本
支援上傳 .bot 檔案取代目前 Agent 設定,並儲存為新版本。
該 API 使用目標 Agent 自身的 API Key 進行驗證,僅允許已開啟版本管理權限的 Agent 調用。
請求方式
POST
調用地址
https://api.${endpoint}/v1/agent/version/import
調用驗證
詳情請參閱 API 概述的驗證方式說明。請使用目標 Agent 的 API Key 作為 token。
請求
請求範例
curl -X POST 'https://api.${endpoint}/v1/agent/version/import' \
-H 'Authorization: Bearer ${token}' \
-F 'file=@/path/to/agent.bot' \
-F 'versionDesc=Update prompt and tools'
curl -X POST 'https://api.${endpoint}/v1/agent/version/import' \
-H 'Authorization: Bearer ${token}' \
-F 'file=@/path/to/agent.bot' \
-F 'versionDesc=Update prompt and tools'
此代碼塊在浮窗中顯示
請求標頭
| 欄位 | 類型 | 說明 |
|---|---|---|
| Authorization | Bearer ${token} | 使用目標 Agent 的 API Key 進行調用驗證。 |
| Content-Type | multipart/form-data | 檔案上傳表單。 |
請求參數(Form Data)
| 參數 | 類型 | 說明 | required |
|---|---|---|---|
| file | File | .bot 檔案。 |
true |
| versionDesc | String | 版本說明。 | false |
回應
回應內容
{
"code": 0,
"message": "OK",
"data": {
"botId": "bot-xxxx",
"botType": "Agent",
"version": "v2",
"warning": null
}
}
{
"code": 0,
"message": "OK",
"data": {
"botId": "bot-xxxx",
"botType": "Agent",
"version": "v2",
"warning": null
}
}
此代碼塊在浮窗中顯示
成功回應
| 欄位 | 類型 | 說明 |
|---|---|---|
| botId | String | 目標 Agent ID。 |
| bot_type | String | Agent 類型:Agent、FlowAgent、LoopAgent、Audio。 |
| version | String | 儲存的版本號,同時成為目前版本。 |
| warning | String | 匯入警告訊息,無則為 null。 |
失敗回應
| 欄位 | 類型 | 說明 |
|---|---|---|
| code | int | 錯誤碼。 |
| message | string | 錯誤訊息。 |
狀態碼
| 狀態碼 | 說明 |
|---|---|
| 200 | 成功 |
| 400 | 參數錯誤 |
| 401 | 未授權 |
| 403 | 權限不足或 API Key 未開啟版本管理權限 |
| 429 | 請求過於頻繁 |
| 500 | 伺服器錯誤 |
