对话历史
curl --request POST \
--url https://open.bigmodel.cn/api/v1/agents/conversation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>",
"conversation_id": "<string>",
"custom_variables": {
"include_pdf": true,
"pages": [
{
"position": 123,
"width": 123,
"height": 123
}
]
}
}
'import requests
url = "https://open.bigmodel.cn/api/v1/agents/conversation"
payload = {
"agent_id": "<string>",
"conversation_id": "<string>",
"custom_variables": {
"include_pdf": True,
"pages": [
{
"position": 123,
"width": 123,
"height": 123
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: '<string>',
conversation_id: '<string>',
custom_variables: {include_pdf: true, pages: [{position: 123, width: 123, height: 123}]}
})
};
fetch('https://open.bigmodel.cn/api/v1/agents/conversation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://open.bigmodel.cn/api/v1/agents/conversation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"custom_variables\": {\n \"include_pdf\": true,\n \"pages\": [\n {\n \"position\": 123,\n \"width\": 123,\n \"height\": 123\n }\n ]\n }\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://open.bigmodel.cn/api/v1/agents/conversation"
payload := strings.NewReader("{\n \"agent_id\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"custom_variables\": {\n \"include_pdf\": true,\n \"pages\": [\n {\n \"position\": 123,\n \"width\": 123,\n \"height\": 123\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://open.bigmodel.cn/api/v1/agents/conversation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent_id' => '<string>',
'conversation_id' => '<string>',
'custom_variables' => [
'include_pdf' => true,
'pages' => [
[
'position' => 123,
'width' => 123,
'height' => 123
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"conversation_id": "<string>",
"agent_id": "<string>",
"choices": [
{
"message": [
{
"role": "<string>",
"content": [
{
"type": "<string>",
"tag_cn": "<string>",
"tag_en": "<string>",
"file_url": "<string>",
"image_url": "<string>"
}
]
}
]
}
],
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Agent API
对话历史
查询智能体对话历史,现仅支持 slides_glm_agent 智能体。点击 Try it 按钮可快速试用。
POST
/
v1
/
agents
/
conversation
对话历史
curl --request POST \
--url https://open.bigmodel.cn/api/v1/agents/conversation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>",
"conversation_id": "<string>",
"custom_variables": {
"include_pdf": true,
"pages": [
{
"position": 123,
"width": 123,
"height": 123
}
]
}
}
'import requests
url = "https://open.bigmodel.cn/api/v1/agents/conversation"
payload = {
"agent_id": "<string>",
"conversation_id": "<string>",
"custom_variables": {
"include_pdf": True,
"pages": [
{
"position": 123,
"width": 123,
"height": 123
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: '<string>',
conversation_id: '<string>',
custom_variables: {include_pdf: true, pages: [{position: 123, width: 123, height: 123}]}
})
};
fetch('https://open.bigmodel.cn/api/v1/agents/conversation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://open.bigmodel.cn/api/v1/agents/conversation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"custom_variables\": {\n \"include_pdf\": true,\n \"pages\": [\n {\n \"position\": 123,\n \"width\": 123,\n \"height\": 123\n }\n ]\n }\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://open.bigmodel.cn/api/v1/agents/conversation"
payload := strings.NewReader("{\n \"agent_id\": \"<string>\",\n \"conversation_id\": \"<string>\",\n \"custom_variables\": {\n \"include_pdf\": true,\n \"pages\": [\n {\n \"position\": 123,\n \"width\": 123,\n \"height\": 123\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://open.bigmodel.cn/api/v1/agents/conversation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent_id' => '<string>',
'conversation_id' => '<string>',
'custom_variables' => [
'include_pdf' => true,
'pages' => [
[
'position' => 123,
'width' => 123,
'height' => 123
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"conversation_id": "<string>",
"agent_id": "<string>",
"choices": [
{
"message": [
{
"role": "<string>",
"content": [
{
"type": "<string>",
"tag_cn": "<string>",
"tag_en": "<string>",
"file_url": "<string>",
"image_url": "<string>"
}
]
}
]
}
],
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Body
application/json
Was this page helpful?
⌘I