# 发送消息
该接口方法需要安装 AI智能体应用,如未安装需要前往安装才可以使用
# 接口英文名
ai_bot_send_msg
# 调用方式
# 云能力初始化
参考 使用指南-接口方式调用-云能力初始化
部分
# 调用接口
可以通过callFunction
调用云模板提供的接口
wx.cloud.callFunction({
name: "cloudbase_module",
data: {
name: "ai_bot_send_msg",
data: {
msg: "markdown-it是什么",
history: [
{ role: "user", content: "12323" },
{ role: "assistant", content: "12323" },
],
bot: "addca5a16644370f00e32d0c75ffe581",
},
},
success: (res) => {},
});
# 入参:
参数 | 类型 | 必填 | 描述 |
---|---|---|---|
bot | string | 是 | 智能体的_id |
msg | string | 是 | 要发送的消息 |
history | object | 否 | 消息的历史记录,输入变量必须为列表对象,且列表的每一项必须包含 role 和 content 两个字段。通常情况下,你需要将大模型节点的历史执行结果保存下来,作为这里的输入 |
history.role | string | 否 | 消息的角色, 可选值:user、assistant、system |
history.content | string | 否 | 消息的内容 |
# 出参:
参数 | 类型 | 描述 |
---|---|---|
result | object | |
result.records | array of object | |
result.records[]._id | string | 唯一标识符 |
result.records[].bot | string | 智能体ID |
result.records[].content | string | 消息内容 |
result.records[].conversation | string | 对话的唯一标识符 |
result.records[].createdAt | integer | 创建时间(时间戳) |
result.records[].role | string | 角色类型 |
result.records[].sender | string | 发送者的唯一标识符 |
result.records[].trace_id | string | 跟踪唯一标识符 |
result.records[].trigger_src | string | 触发源 |
result.records[].type | string | 消息类型 |
result.records[].updatedAt | integer | 更新时间(时间戳) |
requestId | string | 请求唯一标识符 |