取得相關文件
取得相關文件
根據輸入的 message_id,檢索 Agent 回覆訊息時所引用的文件資料。回應內容包含文件 ID、文件名稱,以及來源 URL 等欄位。
請求方法
POST
請求 URL
https://api-${endpoint}.gptbots.ai/v1/bot/data/references
請求授權驗證
請參閱「概覽」以瞭解授權驗證詳情。
請求
請求範例
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/bot/data/references' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"message_id": "xxxxx"
}'
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/bot/data/references' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"message_id": "xxxxx"
}'
此代碼塊在浮窗中顯示
請求標頭
| 欄位 | 類型 | 描述 |
|---|---|---|
| Authorization | Bearer ${token} | 使用 Authorization: Bearer ${token} 作為授權驗證。您可以從 API Keys 頁面取得密鑰作為 token。 |
| Content-Type | application/json | 內容類型,固定為 application/json。 |
請求主體
| 欄位 | 類型 | 必填 | 描述 |
|---|---|---|---|
| message_id | string | 是 | Agent 回覆的訊息 ID。 |
回應
回應範例
{
"code": 0,
"msg": "success",
"data": {
"conversationId": "65dc320df07244300b25b993",
"questionId": "65dc323ef07244300b25b9c5",
"answerId": "65dc323ef07244300b25b9c6",
"refDoc": [
{
"dataId": "65dc3234f07244300b25b9b9",
"dataName": "中國的歷史",
"sourceUrl": "https://www.example.com/chinese-history"
}
]
}
}
{
"code": 0,
"msg": "success",
"data": {
"conversationId": "65dc320df07244300b25b993",
"questionId": "65dc323ef07244300b25b9c5",
"answerId": "65dc323ef07244300b25b9c6",
"refDoc": [
{
"dataId": "65dc3234f07244300b25b9b9",
"dataName": "中國的歷史",
"sourceUrl": "https://www.example.com/chinese-history"
}
]
}
}
此代碼塊在浮窗中顯示
成功回應
| 欄位 | 類型 | 描述 |
|---|---|---|
| conversationId | string | 對話 ID。 |
| questionId | string | 使用者問題的訊息 ID。 |
| answerId | string | Agent 回覆的訊息 ID。 |
| refDoc | JSON Array | 引用的相關文件資料。 |
| dataId | string | 文件 ID。 |
| dataName | string | 文件名稱。 |
| sourceUrl | string | 文件來源 URL。 |
失敗回應
| 欄位 | 類型 | 描述 |
|---|---|---|
| code | int | 錯誤碼 |
| msg | string | 錯誤詳情 |
錯誤碼
| 錯誤碼 | 錯誤訊息 |
|---|---|
| 40000 | 無效參數 |
| 40379 | 信用額度不足 |
| 40378 | Agent 已刪除 |
| 20055 | API 已被禁用 |
| 40127 | 開發者授權驗證失敗 |
