知識庫(舊版)
取得 AI 助理的所有檔案的文本節點
GET /api/chatbot-text-nodes/
參數
參數名稱
必填
類型
說明
chatbotFile
❌
string
【將棄用】Chatbot 檔案 ID(請使用 knowledge_base_file)
cursor
❌
string
The pagination cursor value.
knowledgeBaseFile
❌
string
知識庫檔案 ID(建議使用)
pageSize
❌
integer
Number of results to return per page.
程式碼範例
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/chatbot-text-nodes/?chatbotFile=example&cursor=example&knowledgeBaseFile=example&pageSize=1" \
-H "Authorization: Api-Key YOUR_API_KEY"
# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY'
}
};
axios.get("https://api.maiagent.ai/api/chatbot-text-nodes/?chatbotFile=example&cursor=example&knowledgeBaseFile=example&pageSize=1", config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});import requests
url = "https://api.maiagent.ai/api/chatbot-text-nodes/?chatbotFile=example&cursor=example&knowledgeBaseFile=example&pageSize=1"
headers = {
"Authorization": "Api-Key YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->get("https://api.maiagent.ai/api/chatbot-text-nodes/?chatbotFile=example&cursor=example&knowledgeBaseFile=example&pageSize=1", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY'
]
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>回應內容
狀態碼: 200
回應結構範例
{
"next"?: string (uri) // 非必填
"previous"?: string (uri) // 非必填
"results": [
{
"id": string (uuid)
"charactersCount": integer
"hitsCount": integer
"text": string
"updatedAt": string (timestamp)
"filename": string
"chatbotFile": string (uuid)
"knowledgeBaseFile": string (uuid) // 與 get_chatbot_file 相同,提供向後兼容
"pageNumber": integer
}
]
}回應範例值
{
"next": "http://api.example.org/accounts/?cursor=cD00ODY%3D\"",
"previous": "http://api.example.org/accounts/?cursor=cj0xJnA9NDg3",
"results": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"charactersCount": 456,
"hitsCount": 456,
"text": "回應字串",
"updatedAt": "回應字串",
"filename": "回應字串",
"chatbotFile": "550e8400-e29b-41d4-a716-446655440000",
"knowledgeBaseFile": "550e8400-e29b-41d4-a716-446655440000",
"pageNumber": 456
}
]
}取得 AI 助理的特定檔案的文本節點
GET /api/chatbot-text-nodes/{id}/
參數
參數名稱
必填
類型
說明
id
✅
string
A UUID string identifying this ChatbotTextNode.
程式碼範例
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/chatbot-text-nodes/550e8400-e29b-41d4-a716-446655440000/" \
-H "Authorization: Api-Key YOUR_API_KEY"
# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY'
}
};
axios.get("https://api.maiagent.ai/api/chatbot-text-nodes/550e8400-e29b-41d4-a716-446655440000/", config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});import requests
url = "https://api.maiagent.ai/api/chatbot-text-nodes/550e8400-e29b-41d4-a716-446655440000/"
headers = {
"Authorization": "Api-Key YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->get("https://api.maiagent.ai/api/chatbot-text-nodes/550e8400-e29b-41d4-a716-446655440000/", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY'
]
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>回應內容
狀態碼: 200
回應結構範例
{
"id": string (uuid)
"charactersCount": integer
"hitsCount": integer
"text": string
"updatedAt": string (timestamp)
"filename": string
"chatbotFile": string (uuid)
"knowledgeBaseFile": string (uuid) // 與 get_chatbot_file 相同,提供向後兼容
"pageNumber": integer
}回應範例值
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"charactersCount": 456,
"hitsCount": 456,
"text": "回應字串",
"updatedAt": "回應字串",
"filename": "回應字串",
"chatbotFile": "550e8400-e29b-41d4-a716-446655440000",
"knowledgeBaseFile": "550e8400-e29b-41d4-a716-446655440000",
"pageNumber": 456
}搜尋測試
POST /api/chatbots/{id}/search/
參數
參數名稱
必填
類型
說明
id
✅
string
A UUID string identifying this Chatbot.
largeLanguageModel
❌
string
page
❌
integer
A page number within the paginated result set.
pageSize
❌
integer
Number of results to return per page.
query
❌
string
replyMode
❌
string
請求內容
請求參數
欄位
類型
必填
說明
queryMetadata
object
否
查詢元數據,用於控制搜尋範圍和方式
請求結構範例
{
"queryMetadata"?: object // 查詢元數據,用於控制搜尋範圍和方式 (非必填)
}請求範例值
{
"queryMetadata": null
}程式碼範例
# 呼叫 API 示例 (Shell)
curl -X POST "https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/search/?largeLanguageModel=550e8400-e29b-41d4-a716-446655440000&page=1&pageSize=1&query=example&replyMode=example" \
-H "Authorization: Api-Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "範例字串",
"queryMetadata": null
}'
# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY',
'Content-Type': 'application/json'
}
};
// 請求內容 (payload)
const data = {
"query": "範例字串",
"queryMetadata": null
};
axios.post("https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/search/?largeLanguageModel=550e8400-e29b-41d4-a716-446655440000&page=1&pageSize=1&query=example&replyMode=example", data, config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});import requests
url = "https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/search/?largeLanguageModel=550e8400-e29b-41d4-a716-446655440000&page=1&pageSize=1&query=example&replyMode=example"
headers = {
"Authorization": "Api-Key YOUR_API_KEY",
"Content-Type": "application/json"
}
# 請求內容 (payload)
data = {
"query": "範例字串",
"queryMetadata": null
}
response = requests.post(url, json=data, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->post("https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/search/?largeLanguageModel=550e8400-e29b-41d4-a716-446655440000&page=1&pageSize=1&query=example&replyMode=example", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY',
'Content-Type' => 'application/json'
],
'json' => {
"query": "範例字串",
"queryMetadata": null
}
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>回應內容
狀態碼: 200
回應結構範例
{
"next"?: string (uri) // 非必填
"previous"?: string (uri) // 非必填
"results": [
{
"id": string (uuid)
"charactersCount": integer
"hitsCount": integer
"text": string
"updatedAt": string (timestamp)
"filename": string
"chatbotFile": string (uuid)
"knowledgeBaseFile": string (uuid) // 與 get_chatbot_file 相同,提供向後兼容
"pageNumber": integer
}
]
}回應範例值
{
"next": "http://api.example.org/accounts/?cursor=cD00ODY%3D\"",
"previous": "http://api.example.org/accounts/?cursor=cj0xJnA9NDg3",
"results": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"charactersCount": 456,
"hitsCount": 456,
"text": "回應字串",
"updatedAt": "回應字串",
"filename": "回應字串",
"chatbotFile": "550e8400-e29b-41d4-a716-446655440000",
"knowledgeBaseFile": "550e8400-e29b-41d4-a716-446655440000",
"pageNumber": 456
}
]
}列出檔案類型支援的解析器
GET /api/parsers/supported-file-types/
程式碼範例
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/parsers/supported-file-types/" \
-H "Authorization: Api-Key YOUR_API_KEY"
# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。const axios = require('axios');
// 設定請求標頭
const config = {
headers: {
'Authorization': 'Api-Key YOUR_API_KEY'
}
};
axios.get("https://api.maiagent.ai/api/parsers/supported-file-types/", config)
.then(response => {
console.log('成功取得回應:');
console.log(response.data);
})
.catch(error => {
console.error('請求發生錯誤:');
console.error(error.response?.data || error.message);
});import requests
url = "https://api.maiagent.ai/api/parsers/supported-file-types/"
headers = {
"Authorization": "Api-Key YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
try:
print("成功取得回應:")
print(response.json())
except Exception as e:
print("請求發生錯誤:", e)<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
try {
$response = $client->get("https://api.maiagent.ai/api/parsers/supported-file-types/", [
'headers' => [
'Authorization' => 'Api-Key YOUR_API_KEY'
]
]);
$data = json_decode($response->getBody(), true);
echo "成功取得回應:\n";
print_r($data);
} catch (Exception $e) {
echo '請求發生錯誤: ' . $e->getMessage();
}
?>回應內容
狀態碼: 200
回應結構範例
[
{
"fileType": string
"parsers": [
{
"id": string (uuid)
"name": string
"provider":
{
}
"order"?: integer // 非必填
}
]
}
]回應範例值
[
[
{
"fileType": ".pdf",
"parsers": [
{
"id": "ab83f144-5026-4bce-993f-5c982cc19318",
"name": "MaiAgent Parser",
"provider": "maiagent",
"order": 0,
"isDefault": true
},
{
"id": "22fdcbb5-f075-4aad-bb81-048289ca4b25",
"name": "MaiAgent Parser (Online)",
"provider": "llama",
"order": 2,
"isDefault": false
}
]
},
{
"fileType": ".doc",
"parsers": [
{
"id": "ab83f144-5026-4bce-993f-5c982cc19318",
"name": "MaiAgent Parser",
"provider": "maiagent",
"order": 0,
"isDefault": true
},
{
"id": "22fdcbb5-f075-4aad-bb81-048289ca4b25",
"name": "MaiAgent Parser (Online)",
"provider": "llama",
"order": 2,
"isDefault": false
}
]
},
{
"fileType": ".docx",
"parsers": [
{
"id": "ab83f144-5026-4bce-993f-5c982cc19318",
"name": "MaiAgent Parser",
"provider": "maiagent",
"order": 0,
"isDefault": true
},
{
"id": "22fdcbb5-f075-4aad-bb81-048289ca4b25",
"name": "MaiAgent Parser (Online)",
"provider": "llama",
"order": 2,
"isDefault": false
}
]
},
{
"fileType": ".ppt",
"parsers": [
{
"id": "ab83f144-5026-4bce-993f-5c982cc19318",
"name": "MaiAgent Parser",
"provider": "maiagent",
"order": 0,
"isDefault": true
},
{
"id": "22fdcbb5-f075-4aad-bb81-048289ca4b25",
"name": "MaiAgent Parser (Online)",
"provider": "llama",
"order": 2,
"isDefault": false
}
]
},
{
"fileType": ".pptx",
"parsers": [
{
"id": "ab83f144-5026-4bce-993f-5c982cc19318",
"name": "MaiAgent Parser",
"provider": "maiagent",
"order": 0,
"isDefault": true
},
{
"id": "22fdcbb5-f075-4aad-bb81-048289ca4b25",
"name": "MaiAgent Parser (Online)",
"provider": "llama",
"order": 2,
"isDefault": false
}
]
},
{
"fileType": ".xls",
"parsers": [
{
"id": "ab83f144-5026-4bce-993f-5c982cc19318",
"name": "MaiAgent Parser",
"provider": "maiagent",
"order": 0,
"isDefault": true
}
]
},
{
"fileType": ".xlsx",
"parsers": [
{
"id": "ab83f144-5026-4bce-993f-5c982cc19318",
"name": "MaiAgent Parser",
"provider": "maiagent",
"order": 0,
"isDefault": true
}
]
},
{
"fileType": ".csv",
"parsers": [
{
"id": "ab83f144-5026-4bce-993f-5c982cc19318",
"name": "MaiAgent Parser",
"provider": "maiagent",
"order": 0,
"isDefault": true
}
]
},
{
"fileType": ".txt",
"parsers": [
{
"id": "ab83f144-5026-4bce-993f-5c982cc19318",
"name": "MaiAgent Parser",
"provider": "maiagent",
"order": 0,
"isDefault": true
},
{
"id": "22fdcbb5-f075-4aad-bb81-048289ca4b25",
"name": "MaiAgent Parser (Online)",
"provider": "llama",
"order": 2,
"isDefault": false
}
]
},
{
"fileType": ".md",
"parsers": [
{
"id": "ab83f144-5026-4bce-993f-5c982cc19318",
"name": "MaiAgent Parser",
"provider": "maiagent",
"order": 0,
"isDefault": true
}
]
},
{
"fileType": ".json",
"parsers": [
{
"id": "ab83f144-5026-4bce-993f-5c982cc19318",
"name": "MaiAgent Parser",
"provider": "maiagent",
"order": 0,
"isDefault": true
}
]
},
{
"fileType": ".jsonl",
"parsers": [
{
"id": "ab83f144-5026-4bce-993f-5c982cc19318",
"name": "MaiAgent Parser",
"provider": "maiagent",
"order": 0,
"isDefault": true
}
]
},
{
"fileType": ".html",
"parsers": [
{
"id": "22fdcbb5-f075-4aad-bb81-048289ca4b25",
"name": "MaiAgent Parser (Online)",
"provider": "llama",
"order": 2,
"isDefault": false
}
]
},
{
"fileType": ".mp3",
"parsers": [
{
"id": "4c47e305-2eb7-4438-8d3c-d91eb0b06cc0",
"name": "Azure Speech",
"provider": "azure",
"order": 1,
"isDefault": true
},
{
"id": "22fdcbb5-f075-4aad-bb81-048289ca4b25",
"name": "MaiAgent Parser (Online)",
"provider": "llama",
"order": 2,
"isDefault": false
}
]
},
{
"fileType": ".wav",
"parsers": [
{
"id": "4c47e305-2eb7-4438-8d3c-d91eb0b06cc0",
"name": "Azure Speech",
"provider": "azure",
"order": 1,
"isDefault": true
},
{
"id": "22fdcbb5-f075-4aad-bb81-048289ca4b25",
"name": "MaiAgent Parser (Online)",
"provider": "llama",
"order": 2,
"isDefault": false
}
]
},
{
"fileType": ".mp4",
"parsers": [
{
"id": "22fdcbb5-f075-4aad-bb81-048289ca4b25",
"name": "MaiAgent Parser (Online)",
"provider": "llama",
"order": 2,
"isDefault": false
}
]
}
]
]Last updated
Was this helpful?
