如何在传递上下文的 LuisActionDialog 中从一个意图跳转到另一个意图

How to jump from one intent to another in LuisActionDialog passing context

我正在使用 Microsoft Bot Framework、LUIS 和 LUISActionBinding 开发机器人。

在我的 LUIS 应用程序中,我有 3 个主要意图:BuyXFindAFindB .该机器人的主要目标是帮助用户购买 X,但他们可能希望先使用一些过滤器搜索 A 或 B,或者直接去购买 X。

我使用必填字段和可选字段为每个意图设置了操作,一切正常,我能够接收由我的意图处理程序的操作返回的对象。

在 FindA 处理程序中,我帮助用户选择一个 A,在 FindB 处理程序中,我帮助用户选择一个 B。在 BuyX 中,我需要来自 A 和 B 的信息才能继续。但是如果用户执行了 FindA 或 FindB 对话框,我想重复使用我在那里得到的东西。

我的问题是如何从 Intent FindA 触发 Intent BuyX,以便代码到达我的 BuyXAction class with 一些属性已经根据我的分配能够从 FindA 动作+意图中获取。

这样一来,用户就不必在 FindA 对话框中输入任何表示他想购买 X 的内容,也不必重复他已经 did/select 的内容。

提前致谢。

我相信 SubActions 的概念可能会对您有所帮助。查看此 documentation topic 以了解有关其工作原理和一些代码亮点的更多信息。

Trigger a Contextual Action with no previous Context (ie. from scratch)

The user can provide an input that will trigger a contextual action (with no current context). The framework supports this scenario by providing a way to instantiate the contexts chain for it (ie. the chain of parent actions that provides will provide the whole context), and finally executes the request.