保存制品
curl --request POST \
--url http://localhost:8000/apps/{app_name}/users/{user_id}/sessions/{session_id}/artifacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "notes.txt",
"artifact": {
"text": "Travel notes"
}
}
'import requests
url = "http://localhost:8000/apps/{app_name}/users/{user_id}/sessions/{session_id}/artifacts"
payload = {
"filename": "notes.txt",
"artifact": { "text": "Travel notes" }
}
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({filename: 'notes.txt', artifact: {text: 'Travel notes'}})
};
fetch('http://localhost:8000/apps/{app_name}/users/{user_id}/sessions/{session_id}/artifacts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"version": 123,
"canonicalUri": "<string>",
"customMetadata": {},
"createTime": 123,
"mimeType": "<string>"
}{
"detail": "<string>"
}{
"error": "CONTENT_LENGTH_REQUIRED"
}{
"error": "REQUEST_TOO_LARGE"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "<string>"
}制品
保存制品
以 Part 保存制品的新版本,返回版本号、URI 和元数据
POST
/
apps
/
{app_name}
/
users
/
{user_id}
/
sessions
/
{session_id}
/
artifacts
保存制品
curl --request POST \
--url http://localhost:8000/apps/{app_name}/users/{user_id}/sessions/{session_id}/artifacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "notes.txt",
"artifact": {
"text": "Travel notes"
}
}
'import requests
url = "http://localhost:8000/apps/{app_name}/users/{user_id}/sessions/{session_id}/artifacts"
payload = {
"filename": "notes.txt",
"artifact": { "text": "Travel notes" }
}
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({filename: 'notes.txt', artifact: {text: 'Travel notes'}})
};
fetch('http://localhost:8000/apps/{app_name}/users/{user_id}/sessions/{session_id}/artifacts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"version": 123,
"canonicalUri": "<string>",
"customMetadata": {},
"createTime": 123,
"mimeType": "<string>"
}{
"detail": "<string>"
}{
"error": "CONTENT_LENGTH_REQUIRED"
}{
"error": "REQUEST_TOO_LARGE"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "<string>"
}此操作会向当前制品存储写入一个新版本,重复发送相同请求也可能产生新版本。提交前确认内容与目标应用、用户和会话
artifact.text;二进制内容使用 artifact.inlineData,并提供 mimeType 与 Base64 编码的 data。保存后使用响应中的 version 读取确切版本,canonicalUri 是否可直接访问取决于存储后端与访问权限授权
本地未配置网关时可不提供;云部署使用 Runtime API Key 或部署要求的用户池 JWT,不能使用模型 API Key
请求体
application/json
最后修改于 2026年9月19日