查询系统记忆列表
更新时间:2025-05-16
功能介绍
本接口用于查询系统记忆列表。
使用说明
本文API支持通过Python SDK、Go SDK、Java SDK 和 Node.js SDK调用,调用流程请参考SDK安装及使用流程。
SDK调用
调用示例
1import os
2from qianfan import resources
3
4# 通过环境变量初始化认证信息
5# 使用安全认证AK/SK调用,替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk,如何获取请查看https://cloud.baidu.com/doc/Reference/s/9jwvz2egb
6os.environ["QIANFAN_ACCESS_KEY"] = "your_iam_ak"
7os.environ["QIANFAN_SECRET_KEY"] = "your_iam_sk"
8
9
10
11resp = resources.console.utils.call_action(
12 # 调用本文API,该参数值为固定值,无需修改;对应API调用文档-请求结构-请求地址的后缀
13 "/v2/memory",
14 # 调用本文API,该参数值为固定值,无需修改;对应API调用文档-请求参数-Query参数的Action
15 "DescribeSystemMemories",
16 # 请查看本文请求参数说明,根据实际使用选择参数;对应API调用文档-请求参数-Body参数
17 {
18 "appId": "48xxxx17"
19 }
20)
21
22print(resp.body)
1package main
2import (
3 "context"
4 "fmt"
5 "os"
6
7 "github.com/baidubce/bce-qianfan-sdk/go/qianfan"
8)
9func main() {
10 // 使用安全认证AK/SK鉴权,通过环境变量初始化;替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk
11 os.Setenv("QIANFAN_ACCESS_KEY", "your_iam_ak")
12 os.Setenv("QIANFAN_SECRET_KEY", "your_iam_sk")
13
14 ca := qianfan.NewConsoleAction()
15
16 res, err := ca.Call(context.TODO(),
17 // 调用本文API,该参数值为固定值,无需修改;对应API调用文档-请求结构-请求地址的后缀
18 "/v2/memory",
19 // 调用本文API,该参数值为固定值,无需修改;对应API调用文档-请求参数-Query参数的Action
20 "DescribeSystemMemories",
21 // 请查看本文请求参数说明,根据实际使用选择参数;对应API调用文档-请求参数-Body参数
22 map[string]interface{}{
23 "appId": "445xxx28",
24
25 })
26 if err != nil {
27 panic(err)
28 }
29 fmt.Println(string(res.Body))
30
31}
1import com.baidubce.qianfan.Qianfan;
2import com.baidubce.qianfan.model.console.ConsoleResponse;
3import com.baidubce.qianfan.util.CollUtils;
4import com.baidubce.qianfan.util.Json;
5import java.util.Map;
6
7public class Dome {
8 public static void main(String args[]){
9 // 使用安全认证AK/SK鉴权,替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk
10 Qianfan qianfan = new Qianfan("your_iam_ak", "your_iam_sk");
11
12 ConsoleResponse<Map<String, Object>> response = qianfan.console()
13 // 调用本文API,该参数值为固定值,无需修改;对应API调用文档-请求结构-请求地址的后缀
14 .route("/v2/memory")
15 // 调用本文API,该参数值为固定值,无需修改;对应API调用文档-请求参数-Query参数的Action
16 .action("DescribeSystemMemories")
17 // 需要传入参数的场景,可以自行封装请求类,或者使用Map.of()来构建请求Body
18 // Java 8可以使用SDK提供的CollUtils.mapOf()来替代Map.of()
19 // 请查看本文请求参数说明,根据实际使用选择参数;对应API调用文档-请求参数-Body参数
20 .body(CollUtils.mapOf(
21 "appId", "48886017"
22 ))
23 .execute();
24
25 System.out.println(Json.serialize(response));
26 }
27}
1import {consoleAction, setEnvVariable} from "@baiducloud/qianfan";
2
3// 使用安全认证AK/SK鉴权,通过环境变量初始化;替换下列示例中参数,安全认证Access Key替换your_iam_ak,Secret Key替换your_iam_sk
4setEnvVariable('QIANFAN_ACCESS_KEY','your_iam_ak');
5setEnvVariable('QIANFAN_SECRET_KEY','your_iam_sk');
6
7async function main() {
8 //base_api_route:调用本文API,该参数值为固定值,无需修改;对应API调用文档-请求结构-请求地址的后缀
9 //action:调用本文API,该参数值为固定值,无需修改;对应API调用文档-请求参数-Query参数的Action
10 //data:请查看本文请求参数说明,根据实际使用选择参数;对应API调用文档-请求参数-Body参数
11 const res = await consoleAction({base_api_route: '/v2/memory', action: 'DescribeSystemMemories', data: {
12 "appId": "48886017"
13 }
14 });
15
16 console.log(res);
17}
18
19main();
返回示例
1{
2 "requestId": "015dbc85-5de7-4d90-ba3e-7893cecd9dac",
3 "result": {
4 "items": [{
5 "description": "test系统人设描述",
6 "appId": "44555428",
7 "systemMemoryId": "sm-6egwxxxxx"
8 }, {
9 "description": "test da系统人设描述",
10 "appId": "44555428",
11 "systemMemoryId": "sm-4u7nxxxxx"
12 }, {
13 "description": "test",
14 "appId": "44555428",
15 "systemMemoryId": "sm-8f1gxxxxx"
16 }],
17 "PageInfo": {
18 "marker": "",
19 "isTruncated": False,
20 "nextMarker": "",
21 "maxKeys": 100
22 }
23 }
24}
1{
2 "requestId": "1bef3f87-c5b2-4419-936b-50f9884f10d4",
3 "result": {
4 "items": [
5 {
6 "appId": "48886017",
7 "systemMemoryId": "sm-9a8cfb8ee58",
8 "description": "系统人设描述1"
9 },
10 {
11 "appId": "48886019",
12 "systemMemoryId": "sm-9a8cfb8ee58",
13 "description": "系统人设描述2"
14 }
15 ],
16 "pageInfo": {
17 "marker": "jseqvd194abe3umb",
18 "isTruncated": false,
19 "nextMarker": "sdsfds516ca2f4d02",
20 "maxKeys": 3
21 }
22 }
23}
1{
2 requestId: '1bef3f87-c5b2-4419-936b-50f9884f10d4',
3 result: {
4 items: [
5 {
6 appId: '48886017',
7 systemMemoryId: 'sm-9a8cfb8ee58',
8 description: '系统人设描述1'
9 },
10 {
11 appId: '48886019',
12 systemMemoryId: 'sm-9a8cfb8ee58',
13 description: '系统人设描述2'
14 }
15 ],
16 pageInfo: {
17 marker: 'jseqvd194abe3umb',
18 isTruncated: false,
19 nextMarker: 'sdsfds516ca2f4d02',
20 maxKeys: 3
21 }
22 }
23}
请求参数
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
appId | string | 否 | 千帆应用AppID,在控制台-系统管理与统计-应用接入页面查看,如下图所示:![]() |
marker | string | 否 | 本次查询的起始位置,默认值是0 |
maxKeys | int | 否 | 返回的列表长度,默认值是100 |
返回参数
名称 | 类型 | 描述 |
---|---|---|
requestId | string | 请求ID |
code | string | 错误码,错误时返回 |
message | string | 错误信息,请求失败时返回 |
result | object | 请求结果,请求成功时返回 |
result说明
名称 | 类型 | 描述 |
---|---|---|
items | List<object> | 标签数组 |
pageInfo | object | 分页信息 |
items说明
名称 | 类型 | 说明 |
---|---|---|
appId | string | 千帆应用AppID |
systemMemoryId | string | 系统人设标识id |
description | string | 系统人设描述 |
pageInfo说明
名称 | 类型 | 说明 |
---|---|---|
marker | string | 本次查询的起始位置标识 |
isTruncated | bool | 是否只返回了部分数据,说明: · true:表示只返回部分结果,未返回全部结果 · false:表示返回全部结果 |
nextMarker | string | 下次查询的起始位置标记,示例:"pl-dnqpsnv1sahwj604" |
maxKeys | int | 本次查询的页大小,同请求值 |