智能体设备聊天服务

更新时间:2025-08-13 06:18:09下载pdf

API 列表

Action 描述
aiAgent.listChatDeviceHistoryPage 获取聊天记录
aiAgent.delChatDeviceChatHistory 删除智能体角色的历史会话记录
aiAgent.getChatDeviceMemorySwitch 查询智能体设备的记忆开关
aiAgent.delChatDeviceMemory 删除智能体角色的记忆
aiAgent.listChatDeviceMemories 查询智能体角色的记忆列表
aiAgent.updateChatDeviceMemory 更新智能体角色的记忆
aiAgent.listChatDeviceSummary 查询智能体角色的对话总结
aiAgent.updateChatDeviceSummary 更新智能体角色的对话总结
aiAgent.delDeviceChatContext 清除智能体角色的上下文
aiAgent.addChatDeviceCustomRole 创建智能体自定义角色
aiAgent.listChatDeviceCustomRolePage 查询智能体自定义角色列表(分页)
aiAgent.getChatDeviceCustomRoleDetail 查询智能体自定义角色详情
aiAgent.updateChatDeviceCustomRole 修改智能体自定义角色
aiAgent.delChatDeviceCustomRole 删除智能体自定义角色
aiAgent.addChatCustomRoleFromTemplate 从模板创建智能体自定义角色
aiAgent.listChatDeviceRoleTemplates 查询智能体角色模板列表
aiAgent.getChatDeviceRoleTemplateDetail 查询智能体角色模板详情
aiAgent.bindChatDeviceAgentRole 智能体绑定角色
aiAgent.getChatDeviceAgentBindRole 查询智能体绑定的角色
aiAgent.initChatDeviceAgentBindRole 初始化角色和智能体的绑定关系
aiAgent.listChatDeviceAvatar 查询支持的头像列表
aiAgent.listChatDeviceLanguage 查询智能体支持的语言列表
aiAgent.listChatDeviceLargeModel 查询支持的大模型列表
aiAgent.getChatDeviceWakeUpWords 获取唤醒词
aiAgent.listChatDeviceAgentVariable 查询智能体设备变量列表
aiAgent.updateChatDeviceAgentVariable 更新智能体设备变量列表
aiAgent.listChatDeviceTimbreMarket 智能体音色列表获取

智能体聊天服务

获取聊天记录

接口说明

获取设备的聊天历史记录,倒序返回。

接口地址

action: aiAgent.listChatDeviceHistoryPage

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
bind_role_type Integer 绑定角色类型:
  • 0:自定义角色
  • 1:模板角色
  • 2:单角色(即无角色,数据在智能体维度上)
role_id String 角色 ID
gmt_end Long 聊天信息的截止时间(时间戳),小于此时间的聊天信息会被返回
page_size Integer 每页数量(每页最多 20 条)

请求示例

{
  "device_id": "6c50600a0e15d1fb78h***",
  "bind_role_type": 1,
  "role_id": "94300***",
  "gmt_end": 1753079987512,
  "page_size": 20
}

响应参数

参数名 类型 说明
result List 聊天记录列表
success Boolean 请求是否成功
t Long 时间戳

Result 对象说明

参数名 类型 说明
gmt_create Long 聊天时间(时间戳)
answer List 回答内容列表
question List 提问内容列表
request_id String 聊天记录 ID

Answer/Question 对象说明

参数名 类型 说明
context String 消息内容
type String 消息类型

响应示例

{
  "result": [
    {
      "gmt_create": 1753344939913,
      "answer": [
        {
          "context": "你之前有跟我说过***",
          "type": "text"
        }
      ],
      "question": [{ "context": "我的***", "type": "text" }],
      "request_id": "ccbda733-e3d2-4ee3-bb19-d201-***"
    }
  ],
  "success": true,
  "t": 1753707608368
}

删除智能体角色的历史会话记录

接口说明

删除指定设备及角色的历史会话记录。

接口地址

action: aiAgent.delChatDeviceChatHistory

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
bind_role_type Integer 绑定角色类型:
  • 0:自定义角色
  • 1:模板角色
  • 2:单角色(即无角色,数据在智能体维度上)
role_id String 角色 ID
clear_all_history Boolean 是否清除所有历史记录
request_ids String 请求 ID 列表,用逗号分隔(每次最多 20 个)

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "bind_role_type": 1,
  "role_id": "94300***",
  "clear_all_history": false,
  "request_ids": "0ed72c5a-11e4-47f3-a08f-b1d4-42767***,c487de49-d08e-4fb5-a0f0-e181-***"
}

响应参数

参数名 类型 说明
result Boolean 操作结果
success Boolean 请求是否成功
t Long 时间戳

响应示例

{
  "result": true,
  "success": true,
  "t": 1753090288674
}

查询智能体设备的记忆开关

接口说明

查询指定设备的智能体记忆开关状态。

接口地址

action: aiAgent.getChatDeviceMemorySwitch

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***"
}

响应参数

参数名 类型 说明
memory_open Boolean 记忆功能是否开启
summary_open Boolean 总结功能是否开启

响应示例

{
  "memory_open": true,
  "summary_open": true
}

智能体角色服务

删除智能体角色的记忆

接口说明

删除指定设备及角色的记忆内容。

接口地址

action: aiAgent.delChatDeviceMemory

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
bind_role_type Integer 绑定角色类型:
  • 0:自定义角色
  • 1:模板角色
  • 2:单角色(即无角色,数据在智能体维度上)
role_id String 角色 ID
clear_all_memory Boolean 是否清除所有记忆
memory_keys String 记忆键列表,用逗号分隔(每次最多 20 个),clear_all_memoryfalse 时此值必须传递

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "bind_role_type": 1,
  "role_id": "94300***",
  "clear_all_memory": false,
  "memory_keys": "sys.memoryInterests,sys.memoryBirthday"
}

响应参数

参数名 类型 说明
result Boolean 操作结果
success Boolean 请求是否成功
t Long 时间戳

响应示例

{
  "result": true,
  "success": true,
  "t": 1753091337419
}

查询智能体角色的记忆列表

接口说明

获取指定设备及角色的记忆列表。

接口地址

action: aiAgent.listChatDeviceMemories

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
bind_role_type Integer 绑定角色类型:
  • 0:自定义角色
  • 1:模板角色
  • 2:单角色(即无角色,数据在智能体维度上)
role_id String 角色 ID

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "bind_role_type": 1,
  "role_id": "94300***"
}

响应参数

参数名 类型 说明
memory_list List 记忆信息列表
effective_scope_name String 记忆作用域名称
effective_scope Integer 记忆作用域编号

memory_list 对象说明

参数名 类型 说明
memory_value String 记忆内容
memory_key String 记忆键
memory_name String 记忆名称
effective_scope_name String 记忆作用域名称
effective_scope Integer 记忆作用域

响应示例

[
  {
    "memory_list": [
      {
        "memory_value": "踢足球,打篮球,写代码,读书",
        "memory_key": "sys.memoryInterests",
        "memory_name": "兴趣爱好",
        "effective_scope_name": "角色的记忆",
        "effective_scope": 3
      },
      {
        "memory_value": "一百岁",
        "memory_key": "sys.memoryAge",
        "memory_name": "年龄",
        "effective_scope_name": "角色的记忆",
        "effective_scope": 3
      },
      {
        "memory_value": "七月七号",
        "memory_key": "sys.memoryBirthday",
        "memory_name": "生日",
        "effective_scope_name": "角色的记忆",
        "effective_scope": 3
      },
      {
        "memory_value": "涂小鸭",
        "memory_key": "sys.memoryUserFullName",
        "memory_name": "姓名",
        "effective_scope_name": "角色的记忆",
        "effective_scope": 3
      }
    ],
    "effective_scope_name": "角色的记忆",
    "effective_scope": 3
  }
]

更新智能体角色的记忆

接口说明

更新指定设备及角色的记忆内容。

接口地址

action: aiAgent.updateChatDeviceMemory

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
bind_role_type Integer 绑定角色类型:
  • 0:自定义角色
  • 1:模板角色
  • 2:单角色(即无角色,数据在智能体维度上)
role_id String 角色 ID
memory_map Object 记忆内容键值对

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "bind_role_type": 1,
  "role_id": "94300***",
  "memory_map": {
    "sys.memoryInterests": "钓鱼,踢足球,打篮球,写代码,读书,写作,画画",
    "sys.memoryBirthday": "7月7号",
    "sys.memoryAge": "22"
  }
}

响应参数

参数名 类型 说明
result Boolean 操作结果
success Boolean 请求是否成功
t Long 时间戳

响应示例

{
  "result": true,
  "success": true,
  "t": 1753091337419
}

查询智能体角色的对话总结

接口说明

获取指定设备及角色的对话总结信息。

接口地址

action: aiAgent.listChatDeviceSummary

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
bind_role_type Integer 绑定角色类型:
  • 0:自定义角色
  • 1:模板角色
  • 2:单角色(即无角色,数据在智能体维度上)
role_id String 角色 ID

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "bind_role_type": 1,
  "role_id": "94300***"
}

响应参数

参数名 类型 说明
result List 对话总结信息列表
success Boolean 请求是否成功
t Long 时间戳

响应示例

{
  "result": [
    "用户最初介绍自己叫***",
    "用户还提出了诸多问题:询问自己年龄、兴趣爱好、生日;***。 "
  ],
  "success": true,
  "t": 1753189379795
}

更新智能体角色的对话总结

接口说明

更新指定设备及角色的对话总结信息。

接口地址

action: aiAgent.updateChatDeviceSummary

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
bind_role_type Integer 绑定角色类型:
  • 0:自定义角色
  • 1:模板角色
  • 2:单角色(即无角色,数据在智能体维度上)
role_id String 角色 ID
summary_items List 对话总结内容列表

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "bind_role_type": 1,
  "role_id": "94300***",
  "summary_items": [
    "用户兴趣爱好有踢足球、打篮球、读书、游泳***"
  ]
}

响应参数

参数名 类型 说明
result Boolean 操作结果
success Boolean 请求是否成功
t Long 时间戳

响应示例

{
  "result": true,
  "success": true,
  "t": 1753097137086
}

清除智能体角色的上下文

接口说明

清除指定设备角色的对话上下文信息,即再次发起聊天时,上下文中不会带有之前的聊天信息。

接口地址

action: aiAgent.delDeviceChatContext

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
bind_role_type Integer 绑定角色类型:
  • 0:自定义角色
  • 1:模板角色
  • 2:单角色(即无角色,数据在智能体维度上)
role_id String 角色 ID

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "bind_role_type": 1,
  "role_id": "94300***"
}

响应参数

参数名 类型 说明
result Boolean 操作结果
success Boolean 请求是否成功
t Long 时间戳

响应示例

{
  "result": true,
  "success": true,
  "t": 1753091337419
}

创建智能体自定义角色

接口说明

为指定设备创建一个自定义角色。

接口地址

action: aiAgent.addChatDeviceCustomRole

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
role_name String 角色名称
role_desc String 角色描述
role_introduce String 角色介绍
role_img_url String 角色图片 URL
use_lang_code String 使用的语言
use_timbre_id String 使用音色 ID
use_llm_id String 使用 LLM ID
speed String 语速,根据音色而定,可以不指定

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "role_name": "文***",
  "role_desc": "你是一名天文学家",
  "role_introduce": "你是一名天文学家,你有着丰富的知识储备,你善于激发孩子对太空的好奇心和兴趣,你会耐心的解答孩子关于太空的问题。你幽默风趣,受孩子们的欢迎。",
  "role_img_url": "https://images.tuyacn.com/***/icon/2.png",
  "use_lang_code": "zh",
  "use_timbre_id": "6*",
  "use_llm_id": "8*",
  "speed": "50"
}

响应参数

参数名 类型 说明
result String 角色 ID
success Boolean 请求是否成功
t Long 时间戳

响应示例

{
  "result": "163000112",
  "success": true,
  "t": 1753164320995
}

查询智能体自定义角色列表(分页)

接口说明

分页查询指定设备的自定义角色列表。

接口地址

action: aiAgent.listChatDeviceCustomRolePage

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
page_no Integer 页码
page_size Integer 每页数量(每页最多 20 条)

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "page_no": 1,
  "page_size": 10
}

响应参数

参数名 类型 说明
result Object 查询结果
success Boolean 请求是否成功
t Long 时间戳

Result 对象说明

参数名 类型 说明
total Integer 总记录数
list List 角色列表信息

List 对象说明

参数名 类型 说明
use_timbre_id String 使用的音色 ID
role_introduce String 角色介绍
last_text_answer String 最后一次文本回答
use_llm_name String 使用 LLM 名称
role_name String 角色名称
use_lang_code String 使用语言
role_id String 角色 ID
role_desc String 角色描述
template_id String 模板 ID
in_bind Boolean 是否绑定
role_img_url String 角色图片 URL
use_lang_name String 使用语言名称
use_timbre_name String 使用音色名称

响应示例

{
  "result": {
    "total": 2,
    "list": [
      {
        "use_timbre_id": "clone_45701***",
        "role_introduce": "一只活泼的***",
        "last_text_answer": "***",
        "use_llm_name": "1.5 Pro ***",
        "role_name": "测试1***",
        "use_lang_code": "zh",
        "role_id": "165600***",
        "role_desc": "备注",
        "template_id": "94300***",
        "in_bind": true,
        "role_img_url": "https://images.tuyacn.com/smart/***/1748412117d6db500f***.jpeg",
        "use_lang_name": "中文",
        "use_timbre_name": "我的音色"
      }
    ]
  },
  "success": true,
  "t": 1753693705434
}

查询智能体自定义角色详情

接口说明

获取指定设备的自定义角色的详细信息。

接口地址

action: aiAgent.getChatDeviceCustomRoleDetail

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
role_id String 角色 ID

请求示例

{
  "device_id": "6c50600a0e15d1fb78h***",
  "role_id": "165600***"
}

响应参数

参数名 类型 说明
result Object 角色详细信息
success Boolean 请求是否成功
t Long 时间戳

Result 对象说明

参数名 类型 说明
use_llm_id String 使用 LLM ID
use_timbre_id String 使用音色 ID
role_introduce String 角色介绍
use_timbre_tags List 使用音色标签列表
speed String 语速
llm_support_func_tag_list List LLM 支持的功能标签列表 [“functionCall”, “text”, “audio”]
use_llm_name String 使用 LLM 名称
role_name String 角色名称
use_lang_code String 使用语言代码
role_id String 角色 ID
role_desc String 角色备注
template_id String 模板 ID
role_img_url String 角色图片 URL
use_lang_name String 使用语言名称
use_timbre_name String 使用音色名称

响应示例

{
  "result": {
    "use_llm_id": "8*",
    "use_timbre_id": "clone_45701***",
    "role_introduce": "介绍***",
    "use_timbre_tags": ["中文"],
    "speed": "50.0",
    "llm_support_func_tag_list": ["functionCall", "text", "audio"],
    "use_llm_name": "1.5 Pro ***",
    "role_name": "测试***",
    "use_lang_code": "zh",
    "role_id": "165600***",
    "role_desc": "备注",
    "template_id": "94300***",
    "role_img_url": "https://images.tuyacn.com/smart/***/1748412117d6db500f***.jpeg",
    "use_lang_name": "中文",
    "use_timbre_name": "我的音色"
  },
  "success": true,
  "t": 1753694295702
}

修改智能体自定义角色

接口说明

修改指定设备的自定义角色信息。

接口地址

action: aiAgent.updateChatDeviceCustomRole

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
role_id String 角色 ID
role_name String 角色名称
role_desc String 角色描述
role_introduce String 角色介绍
role_img_url String 角色图片 URL
use_lang_code String 使用语言
use_timbre_id String 使用的音色 ID
use_llm_id String 使用的 LLM ID
speed String 使用语言代码

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "role_id": "163000***",
  "role_name": "测试***",
  "role_desc": "描述***",
  "role_introduce": "你是一名学生家教***",
  "role_img_url": "https://images.tuyacn.com/***/icon/2***.png",
  "use_lang_code": "zh",
  "use_timbre_id": "6*",  
  "use_llm_id": "8*",
  "speed": "30"
}

响应参数

参数名 类型 说明
result Boolean 修改是否成功
success Boolean 请求是否成功
t Long 时间戳

响应示例

{
  "result": true,
  "success": true,
  "t": 1753168703906
}

删除智能体自定义角色

接口说明

删除指定设备的自定义角色。

接口地址

action: aiAgent.delChatDeviceCustomRole

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
role_id String 角色 ID

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "role_id": "162600***"
}

响应参数

参数名 类型 说明
result Boolean 删除是否成功
success Boolean 请求是否成功
t Long 时间戳

响应示例

{
  "result": true,
  "success": true,
  "t": 1753169664947
}

从模板创建智能体自定义角色

接口说明

根据模板创建的自定义角色。

接口地址

action: aiAgent.addChatCustomRoleFromTemplate

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
template_id String 模板 ID
role_name String 角色名称
role_desc String 角色描述
role_introduce String 角色介绍
role_img_url String 角色图片 URL
use_lang_code String 使用语言
use_llm_id String 使用 LLM ID
use_timbre_id String 使用音色 ID
speed String 语速
need_bind Boolean 是否直接绑定到创建的角色

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "template_id": "94300***",
  "role_name": "从模板创建的***",
  "role_desc": "描述***",
  "role_introduce": "你是一名天文学家,你有着丰富的知识储备,你善于激发孩子对太空的好奇心和兴趣。***",
  "role_img_url": "https://images.tuyacn.com/***/icon/2***.png",
  "use_lang_code": "zh",
  "use_llm_id": "8*",
  "use_timbre_id": "6*",
  "speed": "30",
  "need_bind": true
}

响应参数

参数名 类型 说明
result String 新创建的角色 ID
success Boolean 请求是否成功
t Long 时间戳

响应示例

{
  "result": "164600***",
  "success": true,
  "t": 1753252126233
}

查询智能体角色模板列表

接口说明

获取设备的智能体角色模板列表。

接口地址

action: aiAgent.listChatDeviceRoleTemplates

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***"
}

响应参数

参数名 类型 说明
result List 角色模板信息列表
success Boolean 请求是否成功
t Long 时间戳

result 对象说明

参数名 类型 说明
role_name String 角色名称
use_llm_id String 使用的 LLM ID
bind_status Boolean 绑定状态:
  • true:已绑定
  • false:未绑定
last_text_answer String 最新的文本回答
use_lang_code String 使用的语言
use_timbre_id String 使用的音色 ID
template_id String 模板 ID
role_introduce String 角色介绍
role_desc String 角色描述
role_img_url String 角色图片 URL
use_lang_name String 使用的语言名称
use_timbre_name String 使用的音色名称
use_llm_name String 使用的 LLM 名称

响应示例

{
  "result": [
    {
      "role_name": "模板***",
      "use_llm_id": "8*",
      "bind_status": false,
      "last_text_answer": "我是***",
      "use_lang_code": "zh",
      "use_timbre_id": "5*",
      "template_id": "63700***",
      "role_introduce": "我是一名***",
      "role_desc": "我是***"
      "role_img_url": "https://images.tuyacn.com/smart/***/17459093538f665740***.png",
      "use_lang_name": "中文",
      "use_timbre_name": "测试***",
      "use_llm_name": "1.5 Pro ***"
    }
  ],
  "success": true,
  "t": 1753252060794
}

查询智能体角色模板详情

接口说明

获取设备的智能体角色模板的详细信息。

接口地址

action: aiAgent.getChatDeviceRoleTemplateDetail

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
template_id String 模板 ID

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "template_id": "94300***"
}

响应参数

参数名 类型 说明
result Object 角色模板详细信息
success Boolean 请求是否成功
t Long 时间戳

Result 对象说明

参数名 类型 说明
use_llm_id String 使用的 LLM ID
use_timbre_id String 使用的音色 ID
role_introduce String 角色介绍
speed String 语速
llm_support_func_tag_list List 支持的功能标签列表
use_llm_name String 使用的 LLM 名称
role_name String 角色名称
use_lang_code String 使用的语言代码
role_id String 角色 ID
role_desc String 角色备注
template_id String 模板 ID
role_img_url String 角色图片 URL
use_lang_name String 使用的语言名称
use_timbre_name String 使用的声音名称

响应示例

{
  "result": {
    "use_llm_id": "8*",
    "use_timbre_id": "1*",
    "role_introduce": "可爱的***",
    "speed": "30.0",
    "llm_support_func_tag_list": ["functionCall", "text", "audio"],
    "use_llm_name": "1.5 Pro ***",
    "role_name": "测试***",
    "use_lang_code": "zh",
    "role_id": "94300***",
    "role_desc": "备注***",
    "template_id": "94300***",
    "role_img_url": "https://images.tuyacn.com/smart/***/17484121597b219879***.jpeg",
    "use_lang_name": "中文",
    "use_timbre_name": "少年梓辛"
  },
  "success": true,
  "t": 1753253131796
}

智能体绑定角色

接口说明

绑定智能体角色到设备。

接口地址

action: aiAgent.bindChatDeviceAgentRole

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
role_id String 角色 ID
bind_role_type Integer 绑定角色类型:
  • 0:自定义角色
  • 1:模板角色
  • 2:单角色(即无角色,数据在智能体维度上)

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "role_id": "94300***",
  "bind_role_type": 1
}

响应参数

参数名 类型 说明
result Boolean 操作是否成功
success Boolean 请求是否成功
t Long 时间戳

响应示例

{
  "result": true,
  "success": true,
  "t": 1753172097839
}

查询智能体绑定的角色

接口说明

获取设备绑定的智能体角色。

接口地址

action: aiAgent.getChatDeviceAgentBindRole

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***"
}

响应参数

参数名 类型 说明
result Object 角色详情
success Boolean 请求是否成功
t Long 时间戳

Result 对象说明

参数名 类型 说明
use_llm_id String 使用的 LLM ID
use_timbre_id String 使用音色 ID
role_introduce String 角色介绍
last_text_answer String 最新的文本回答
speed String 语速
llm_support_func_tag_list List 支持的功能标签列表
use_llm_name String 使用的 LLM 名称
role_name String 角色名称
use_lang_code String 使用的语言
role_id String 角色 ID
bind_role_type Integer 绑定角色类型:
  • 0:自定义角色
  • 1:模板角色
  • 2:单角色(即无角色,数据在智能体维度上)
role_desc String 角色备注
template_id String 角色关联的模板 ID,只有通过模板创建的自定义角色才可能有此值
role_img_url String 角色图片 URL
use_lang_name String 使用的语言名称
use_timbre_name String 使用的声音名称
  • bind_role_type = 0 时为自定义角色,role_id 为自定义角色 ID,template_id 如果有值则为此角色关联的模板角色 ID。
  • bind_role_type = 1 时为模板角色,role_id 为模板角色 ID。

响应示例

{
  "result": {
    "use_llm_id": "8*",
    "use_timbre_id": "clone_45701***",
    "role_introduce": "一名教师***",
    "last_text_answer": "刚刚介绍*** ",
    "speed": "30.0",
    "llm_support_func_tag_list": ["functionCall", "text", "audio"],
    "use_llm_name": "1.5 Pro ***",
    "role_name": "测试***",
    "use_lang_code": "zh",
    "role_id": "165600***",
    "bind_role_type": 0,
    "role_desc": "备注***",
    "template_id": "94300***",
    "role_img_url": "https://images.tuyacn.com/smart/***/1748412117d6db500f***.jpeg",
    "use_lang_name": "中文",
    "use_timbre_name": "我的音色"
  },
  "success": true,
  "t": 1753696939321
}

初始化角色和智能体的绑定关系

接口说明

根据设备 ID 初始化角色和智能体的绑定关系,每次进入智能体功能页面时,都需要进行调用,避免在涂鸦开发者平台侧修改角色后,智能体中没有同步更新。

接口地址

action: aiAgent.initChatDeviceAgentBindRole

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***"
}

响应参数

参数名 类型 说明
result Object 角色详情
success Boolean 请求是否成功
t Long 时间戳

Result 对象说明

参数名 类型 说明
use_llm_id String 使用的 LLM ID
use_timbre_id String 使用的音色 ID
role_introduce String 角色介绍
last_text_answer String 最新的文本回答
speed String 语速
llm_support_func_tag_list List 支持的功能标签列表
use_llm_name String 使用的 LLM 名称
role_name String 角色名称
use_lang_code String 使用的语言
role_id String 角色 ID
bind_role_type Integer 绑定角色类型:
  • 0:自定义角色
  • 1:模板角色
  • 2:单角色(即无角色,数据在智能体维度上)
role_desc String 角色备注
template_id String 角色关联的模板 ID,只有通过模板创建的自定义角色才可能有此值
role_img_url String 角色图片 URL
use_lang_name String 使用的语言名称
use_timbre_name String 使用的音色名称

响应示例

{
  "result": {
    "use_llm_id": "8*",
    "use_timbre_id": "45701***",
    "role_introduce": "一名***",
    "last_text_answer": "不好意思呀*** ",
    "speed": "50.0",
    "llm_support_func_tag_list": ["functionCall", "text", "audio"],
    "use_llm_name": "1.5 Pro ***",
    "role_name": "测试***",
    "use_lang_code": "zh",
    "role_id": "165600***",
    "bind_role_type": 0,
    "role_desc": "备注***",
    "template_id": "94300***",
    "role_img_url": "https://images.tuyacn.com/smart/***/1748412117d6db500f***.jpeg",
    "use_lang_name": "中文",
    "use_timbre_name": "我的音色"
  },
  "success": true,
  "t": 1753697514286
}

智能体配置

查询支持的头像列表

接口说明

获取设备支持的头像列表。

接口地址

action: aiAgent.listChatDeviceAvatar

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***"
}

响应参数

参数名 类型 说明
result List 头像 URL 列表
success Boolean 请求是否成功
t Long 时间戳

Result 对象说明

参数名 类型 说明
url String 头像图片 URL

响应示例

{
  "result": [
    { "url": "https://images.tuyacn.com/***/icon/1***.png" },
    { "url": "https://images.tuyacn.com/***/icon/2***.png" },
    { "url": "https://images.tuyacn.com/***/icon/3***.png" },
    { "url": "https://images.tuyacn.com/***/icon/4***.png" },
    { "url": "https://images.tuyacn.com/***/icon/5***.png" },
    { "url": "https://images.tuyacn.com/***/icon/6***.png" }
  ],
  "success": true,
  "t": 1753155603441
}

查询智能体支持的语言列表

接口说明

获取设备支持的语言列表。

接口地址

action: aiAgent.listChatDeviceLanguage

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***"
}

响应参数

参数名 类型 说明
result List 语言列表
success Boolean 请求是否成功
t Long 时间戳

Result 对象说明

参数名 类型 说明
has_default Boolean 是否为默认语言
lang_name String 语言名称
lang_code String 语言代码

响应示例

{
  "result": [
    { "has_default": false, "lang_name": "湖南话", "lang_code": "zh_hn" },
    { "has_default": false, "lang_name": "闽南语", "lang_code": "zh_mn" },
    { "has_default": false, "lang_name": "英文", "lang_code": "en" },
    { "has_default": true, "lang_name": "中文", "lang_code": "zh" }
  ],
  "success": true,
  "t": 1753162485939
}

查询支持的大模型列表

接口说明

查询设备支持的大模型列表。

接口地址

action: aiAgent.listChatDeviceLargeModel

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***"
}

响应参数

参数名 类型 说明
result List 大模型列表
success Boolean 请求是否成功
t Long 时间戳

Result 对象说明

参数名 类型 说明
llm_name String 大模型名称
llm_id Integer 大模型 ID

响应示例

{
  "result": [
    {
      "llm_name": "1.5 Pro ***",
      "llm_id": 85
    }
  ],
  "success": true,
  "t": 1753162676439
}

获取唤醒词

接口说明

获取设备的唤醒词。

接口地址

action: aiAgent.getChatDeviceWakeUpWords

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***"
}

响应参数

参数名 类型 说明
result String 唤醒词
success Boolean 请求是否成功
t Long 时间戳

响应示例

{
  "result": "测试***",
  "success": true,
  "t": 1753162892431
}

智能体变量

查询智能体设备变量列表

接口说明

查询设备的智能体变量列表,其中以 custom. 开头的为自定义的变量(在涂鸦开发者平台进行配置)。

接口地址

action: aiAgent.listChatDeviceAgentVariable

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***"
}

响应参数

参数名 类型 说明
result List 变量列表
success Boolean 请求是否成功
t Long 时间戳

Result 对象说明

参数名 类型 说明
variable_key String 变量键
variable_value String 变量值

响应示例

{
  "result": [
    {
      "variable_key": "sys.memoryInterests",
      "variable_value": "痴迷宇宙星空、研究各类天文知识"
    },
    {
      "variable_key": "sys.roleSupplementDesc",
      "variable_value": ""
    },
    {
      "variable_key": "sys.roleIntroduce",
      "variable_value": "你是一名天文学家"
    },
    {
      "variable_key": "sys.memoryAge",
      "variable_value": "九十九岁"
    },
    {
      "variable_key": "sys.memoryBirthday",
      "variable_value": "七月七号"
    },
    {
      "variable_key": "sys.memoryHistoryChatSummary",
      "variable_value": "用户询问了***"
    },
    {
      "variable_key": "sys.roleName",
      "variable_value": "测试***"
    },
    {
      "variable_key": "sys.memoryUserFullName",
      "variable_value": ""
    },
    {
      "variable_key": "sys.roleRemark",
      "variable_value": "天文学家"
    },
    {
      "variable_key": "custom.roleName",
      "variable_value": "天文学家"
    },
    {
      "variable_key": "custom.familyName",
      "variable_value": "测试**"
    },
    {
      "variable_key": "custom.userName",
      "variable_value": "张三"
    },
    {
      "variable_key": "custom.userId",
      "variable_value": "12345***"
    }
  ],
  "success": true,
  "t": 1753790540058
}

更新智能体设备变量列表

接口说明

更新设备的智能体变量列表,其中以 custom. 开头的为自定义的变量(需在涂鸦开发者平台进行配置)。custom.开头的变量共有三种生效域:角色家庭账户/环境个人用户,以及两种读写属性:仅读可读可写

接口地址

action: aiAgent.updateChatDeviceAgentVariable

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
variable_map Map 变量映射:
  • key:变量名
  • value:要更新的值
role_id String 角色 ID,当更新的自定义变量生效域为 角色 时此值须传递,若不传递则默认更新的是当前绑定的角色
bind_role_type String 绑定角色类型:
  • 0:自定义角色
  • 1:模板角色
  • 2:单角色(即无角色,数据在智能体维度上)
role_id 传递时,此值必须传递

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "variable_map": {
    "custom.familyName": "testFamilyName"
  }
}

响应参数

参数名 类型 说明
result List 变量更新后的列表
success Boolean 请求是否成功
t Long 时间戳

Result 对象说明

参数名 类型 说明
variable_key String 变量键
variable_value String 变量值

响应示例

{
  "result": [
    {
      "variable_key": "sys.memoryInterests",
      "variable_value": "打篮球,踢足球,写代码,读书,游泳"
    },
    {
      "variable_key": "sys.roleSupplementDesc",
      "variable_value": ""
    },
    {
      "variable_key": "sys.roleIntroduce",
      "variable_value": "一个***"
    },
    {
      "variable_key": "sys.memoryAge",
      "variable_value": "两百岁"
    },
    {
      "variable_key": "sys.memoryBirthday",
      "variable_value": "七月七号"
    },
    {
      "variable_key": "sys.memoryHistoryChatSummary",
      "variable_value": "用户询问*** "
    },
    {
      "variable_key": "sys.roleName",
      "variable_value": "测试角色名称"
    },
    {
      "variable_key": "sys.memoryUserFullName",
      "variable_value": "涂小鸭"
    },
    {
      "variable_key": "sys.roleRemark",
      "variable_value": "张三备注"
    }
  ],
  "success": true,
  "t": 1753175763882
}

智能体音色

智能体音色列表获取

接口说明

获取智能体音色列表。

接口地址

action: aiAgent.listChatDeviceTimbreMarket

请求参数

参数名 类型 说明 是否必填
device_id String 设备 ID
lang String 语言类型
page_no Integer 页码
page_size Integer 每页数量(最多 20 条每页)

请求示例

{
  "device_id": "6c3585ebfe301b40a8u***",
  "lang": "zh",
  "page_no": 1,
  "page_size": 20
}

响应参数

参数名 类型 说明
result Object 音色列表结果
success Boolean 请求是否成功
t Long 时间戳

Result 对象说明

参数名 类型 说明
total Integer 总数
list List 音色详细信息列表

List 对象说明

参数名 类型 说明
demoUrl String 音色示例 URL
voiceId String 音色 ID
voiceName String 音色名称
descTags List 描述标签列表
supportLangs List 支持的语言列表
speed Integer 语速

响应示例

{
  "result": {
    "total": 1,
    "list": [
      {
        "demoUrl": "https://images.tuyacn.com/***/timbre/timbre_2_***.mp3",
        "voiceId": "2*",
        "voiceName": "爽快思思",
        "descTags": ["女", "青年", "中文", "英文"],
        "supportLangs": ["zh", "en"],
        "speed": 30
      }
    ]
  },
  "success": true,
  "t": 1753164054222
}