botframework - 在 Azure Bot 上查看以前的用户消息
问题描述
如何在 Azure Bot 服务中显示以前的用户消息?我从数据库中获取它们,我可以在我的控制台上打印它们。假设我有来自用户 1 的消息 U1 和 B1 机器人对此消息的回复。如何让机器人发送 U1?
每当我尝试发送 U1 和 B1 时,都会作为机器人消息发送出去。我正在使用 Microsoft Azure 机器人。
编辑 1:我在 Node.js 中尝试了 sendConversationHistory() 方法,它工作正常。我能够在机器人模拟器 v4 上查看消息。但是,当相同的代码用于部署时,它会显示错误的活动。有人可以在这里帮助我吗?
部署错误消息:
Error: Invalid activities
at new RestError (D:\home\site\wwwroot\node_modules\@azure\ms-rest-js\lib\restError.ts:18:5)
at D:\home\site\wwwroot\node_modules\@azure\ms-rest-js\lib\policies\deserializationPolicy.ts:117:27
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7),code: 'BadSyntax',statusCode: 400,
正在发送的活动具有以下代码中提到的形式:
const newLocal = [{
type: 'message', text: 'User message', from: context.activity.from, localTimezone: 'America/Los_Angeles', serviceUrl: context.activity.serviceUrl,
channelId: context.activity.channelId, callerId: 'abc', recipient: context.activity.recipient, label: 'test', valueType: 'test', listenFor: ['nothing'],
conversation: { isGroup: false, conversationType: 'test', tenantId: 'abc', id: context.activity.from.id, name: context.activity.from.name, message: 'User message' }
},
{
type: 'message', text: 'Bot message!', from: context.activity.recipient, localTimezone: 'America/Los_Angeles', serviceUrl: context.activity.serviceUrl,
channelId: context.activity.channelId, callerId: 'abc', recipient: context.activity.from, label: 'test', valueType: 'test', listenFor: ['nothing'],
conversation: { isGroup: false, conversationType: 'test', tenantId: 'abc', id: context.activity.from.id, name: context.activity.from.name, message: 'Botmessage' }
}
];
我的问题是它在模拟器上测试时是否正常工作,为什么它在部署时显示不良活动?
解决方案
推荐阅读
- flutter - for 循环显示 RangeError 颤动
- cmake - 为什么链接器无法识别我的链接器脚本中定义的入口点
- ruby-on-rails - 在 Ruby 和 Rails 升级期间 Bundler 显示依赖错误
- javascript - React Material ui 全选复选框
- python - VK_API:音乐、json解码器的问题
- rust - Crate 和 Package 之间的确切区别是什么?
- variables - 如何在 Rust 模块/库中创建变量?
- powerbi - PowerBi - 使用 2 个 X 轴值和 1 个 Y 轴值创建图表
- python - 通过 ssh 连接到 Ubuntu 服务器时,在 vscode 中使用 .env 文件
- flutter - Flutter:在同一个脚手架中像这样制作路由子节点