Microsoft Bot Builder (chat bot) error

自古美人都是妖i 提交于 2019-12-13 20:40:03

问题


The Bot State API is deprecated. Please refer to 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 ?


回答1:


In the previous versions of botbuilder microsoft provided a state api for bots. The state api managed the state of the bot as you might expect; things like the user data, the conversation data, the dialog data etc.

They have since deprecated this API and provided a way which you can implement your own storage adapters, or indeed us available packages to do so.

The botbuilder module provides an in memory storage which obviously is fine while the bot is running but will be lost if the bot crashes and isn't suitable if you intend to load balance the bot across multiple machines.

I tend to use the in memory storage for local development and in production switch it out with a different adapter.

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

However, there are other storage adapters available

The Microsoft package botbuilder-azure offers table storage, CosmosDB storage and SQL storage.

I tend to use the following package botbuilder-storage with the DynamoDB adapter. It also offers Redis and MongoDB adapters.

State management is also documented pretty well here

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




回答2:


Need fix this by manually setting the memory storage:

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

Reference: https://github.com/Microsoft/BotBuilder/issues/3785



来源:https://stackoverflow.com/questions/48259153/microsoft-bot-builder-chat-bot-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!