简体   繁体   English

是否有任何简单的方法可以在 Bot Framework SDKv4 中存储先前的意图值以使用当前话语实体?

[英]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.

相关问题 如何使用 C# 在机器人框架 SDKV4 中开发的网络聊天中显示每条消息的聊天日期和时间? - How to display chat date and time for every message in webchat developed in bot framework SDKV4 using C#? 有没有办法在 C# 和 SDKV4 中创建的 MS Chat BOT 中使用 PromptOptions 突出显示通过选择显示的按钮选项? - Is there a way to highlight a button option displayed through Choice using PromptOptions in MS Chat BOT created in C# and SDKV4? 有没有一种方法可以通过提示选项将选项显示为静止按钮,即使通过 C# SDKV4 在 MSBOT 中很少有选项具有更大长度的文本? - Is there a way to display choices through prompt options as still buttons even though few choices have larger length text in MSBOT via C# SDKV4? 使用Bot框架C#中的对话框,是否有任何简单的方法向用户提示查询顺序? - Is any simple way to prompt sequence of queries to the user using dialog in Bot framework C#? 有什么方法可以从bot框架代码内部访问生成的网络聊天令牌值? - Is there any way to access the generated token value for web chat from inside the bot framework code? 是否有任何方法可以确定在 Entity Framework 6.3 中正在编辑哪些实体 - Is There Any Way to Determine Which Entities are Being Edited in Entity Framework 6.3 有什么办法可以在MS Bot框架上为对话中的其他用户获取botUserData - Is there any way to get botUserData for other user in conversation on MS bot framework Bot Framework简单切换方案 - Bot Framework Simple Handoff Scenario 有没有办法在没有 azure bot 服务的情况下使用身份验证服务? - Is there any way to use authentication service without azure bot service? 如何在LUIS中不使用火车语音的情况下在C#中使用LUIS无意图 - How to use LUIS None Intent in c# without train utterance at LUIS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM