javascript - 如何访问 Microsoft Bot Framework 上的用户数据?

标签 javascript botframework

如果我是正确的,userDataprivateConversationData 等存储在某个远程数据库中。我如何访问该数据库(例如在测试过程中清除它)?

最佳答案

对于基本实现,“所有用户状态数据库”不可访问,您只能按用户执行操作(例如/deleteprofile)。

documentation添加了名为如何对通过 State API 存储的机器人数据进行版本控制的章节?:

The State Service allows you to persist progress through the dialogs in a conversation, so that a user can return to a conversation with a bot days later without losing their position. But if you change your bot's code, the bot data property bags stored through the State API are not automatically cleared. You will have to decide whether the bot data should be cleared based on whether your newer code is compatible with older versions of your data. You can accomplish this in a few ways:

  • During development of your bot, if you want to manually reset the conversation's dialog stack and state, you can use the /deleteprofile command (with the leading space so it's not interpreted by the channel) to clear out the state.
  • During production usage of your bot, you can version your bot data so that if you bump the version, the associated data is cleared. This can be accomplished in Node using the exiting middleware or in C# using an IPostToBot implementation.

If the dialog stack cannot be deserialized correctly (due to serialization format changes or because the code has changed too much), the conversation state will be reset.

另请参阅 topic在 BotBuilder Github 上了解有关存储的信息。 还有这个question也为了国家安全

解决方法

借助 Microsoft 提供的 BotBuilder-Azure 扩展,您可以为机器人使用自己的 Azure 存储。

可在 github 上获取 here它:

enable bot developers to integrate bots with specific Azure components.

  • Azure Table Storage: Allows bot developers to store bot state in their own Azure Storage accounts.

  • DocumentDB: Allows bot developers to store bot state in DocumentDB

因此,一旦设置完毕,您就可以使用 JavaScript 获取数据,因为它是您自己的 Azure 存储。

关于javascript - 如何访问 Microsoft Bot Framework 上的用户数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44308870/

相关文章:

javascript - 如何访问 <input type=file> 内容?

azure - 机器人返回错误 "payment required"

c# - Bot 连接器返回 Forbidden (403) 并显示 Microsoft.Bot.Connector.ErrorResponseException

c# - TeamsBot - 如何从对话更新事件中获取团队 ID?

python - 通过 BotFramework 的 REST API 回复消息的最小示例?

javascript - 让 div 内的所有链接都调用相同的函数?

javascript - Asp.net core api 从 Javascript 获取 "415 Unsupported Media Type"错误,而不是 Postman

javascript - Jquery启用/禁用按钮文本区域验证

javascript - jQuery 隐藏和显示太不加区别,需要更精确

azure - 机器人抛出异常时没有日志