我正在通过模拟器使用MS Botframework V4(预览版)测试。我使用configurations.In - startup.cs来维护一些我声明状态为(用于本地测试)的状态
options.Middleware.Add(new ConversationState<Dictionary<string, object>>(new MemoryStorage()));当用户与我的聊天机器人交互时,例如在第4步中,我正在更新状态值,如下所示
var state = context.GetConversationState<Dictionary<string, object>>();
state["IsActiveDialog"] = false;
state.Remove("CurrentActiveDialog");在接下来的对话步骤(比方说步骤5)中,如果我检查状态,我对状态的更改不会受到影响。即显示true和CurrentActiveDialog属性的state["IsActiveDialog"]仍未删除
我不知道为什么会发生这种事。
发布于 2018-08-08 03:42:44
V4是预览版,正在积极开发中,因此有很大的成交量。如果你想在V4的C#软件开发工具包的当前版本中实现这一点,有一个示例可以演示:
AspNetCore-EchoBot-AppInsights
相关行如下所示:
CounterState = conversationState.CreateProperty<CounterState>(MyAppInsightsBotAccessors.CounterName),From this file在状态上创建属性。
和
// Get the conversation state from the turn context that holds a simple counter
var state = await _stateAccessors.CounterState.GetAsync(turnContext, () => new CounterState());
// Bump the turn count.
state.TurnCount++;从this file访问并利用状态。
https://stackoverflow.com/questions/51710788
复制相似问题