[英]Is there any simple way to store the previous intent value in Bot Framework SDKv4 to make use of with current utterance entities?
Can anyone help me with how to proceed with storing of an intent from previous utterance and binding it to the current entities from the current utterance?任何人都可以帮助我如何继续存储先前话语中的意图并将其绑定到当前话语中的当前实体吗? In short the context management using available state objects?
简而言之,使用可用状态对象的上下文管理? Thank you.
谢谢你。
Like in v3就像在 v3 中一样
Context.UserData.SetValue("intent_name",intent);
string previousIntent = Context.UserData.GetValue<string>("intent_name");
How is this done in V4?这是如何在 V4 中完成的?
In v4 you can get the state properties from the turn context.在 v4 中,您可以从转弯上下文中获取状态属性。
Sample:样本:
var userStateAccessors = _userState.CreateProperty<UserProfile>(nameof(UserProfile));
var userProfile = await userStateAccessors.GetAsync(turnContext, () => new UserProfile());
That is defined on OnMessageActivityAsync Task event, which derived from ActivityHandler class.这是在从 ActivityHandler 类派生的 OnMessageActivityAsync 任务事件上定义的。 You can see more sample details at StateManagementBot.cs from BotBuilder-Sample StateManagement project.
您可以在BotBuilder-Sample StateManagement项目的StateManagementBot.cs 中查看更多示例详细信息。
And this is the Differences between the v3 and v4 .NET SDK这是v3 和 v4 .NET SDK 之间的差异
v4 doesn't use UserData, ConversationData, and PrivateConversationData properties and data bags to manage state.
v4 不使用 UserData、ConversationData 和 PrivateConversationData 属性和数据包来管理状态。 State is managed via state management objects and property accessors.
状态通过状态管理对象和属性访问器进行管理。 v4 defines UserState, ConversationState, and PrivateConversationState classes that manage state data for the bot.
v4 定义了 UserState、ConversationState 和 PrivateConversationState 类,用于管理机器人的状态数据。
Hope this helps.希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.