如果我是正确的,userData
、privateConversationData
等存储在某个远程数据库中。我如何访问该数据库(例如在测试过程中清除它)?
最佳答案
对于基本实现,“所有用户状态数据库”不可访问,您只能按用户执行操作(例如/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/