Microsoft Bot Builder(聊天机器人)错误

Microsoft Bot Builder (chat bot) error

机器人状态 API 已弃用。请参考https://aka.ms/I6swrh for details on how to replace with your own storage. Anyone know what is the problem and how to configure? Is it local storage problem ?

需要通过手动设置内存来解决这个问题:

var bot = new builder.UniversalBot(connector, {
    storage: new builder.MemoryBotStorage()
});

参考: https://github.com/Microsoft/BotBuilder/issues/3785

在以前版本的 botbuilder 中,Microsoft 为机器人提供了一个状态 api。状态 api 如您所料管理机器人的状态;诸如用户数据、对话数据、对话数据等

他们已经弃用了这个 API 并提供了一种方法,您可以实现自己的存储适配器,或者实际上我们可以使用可用的软件包来实现。

botbuilder 模块提供了一个内存存储,当机器人处于 运行 时显然很好,但如果机器人崩溃并且不合适 table 如果您打算进行负载平衡,它将丢失跨多台机器的机器人。

我倾向于将内存存储用于本地开发,而在生产中使用不同的适配器将其切换。

const bot = new builder.UniversalBot(connector, [..waterfall steps..])
   .set('storage', new builder.MemoryBotStorage())

但是,还有其他可用的存储适配器

Microsoft 程序包 botbuilder-azure 提供 table 存储、CosmosDB 存储和 SQL 存储。

我倾向于将以下包 botbuilder-storage 与 DynamoDB 适配器一起使用。它还提供 Redis 和 MongoDB 适配器。

这里也很好地记录了状态管理

https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-state