问题
I'm developing a bot with Microsoft Bot Framework, LUIS and LUISActionBinding.
In my LUIS app I have 3 main intents: BuyX, FindA and FindB. The main goal of the bot is to help users to buy X, but they might want to first search for A or B with some filters first, or just go directly to buy X.
I set up the Actions for each intent with the required and optional fields, everything works great and I'm able to receive objects returned by the actions my intent handlers.
In the FindA handler I help the user selecting one A and in the FindB handler I help the user selecting one B. In BuyX I need info from A and B to proceed. But if users did the FindA or FindB dialog I want to reuse stuff I got there.
My question is how can I trigger intent BuyX from intent FindA, so that the code reaches my BuyXAction class with some properties already assigned based on what I was able to acquire from the FindA action+intent.
This way the user wouldn't have to type anything saying he wants to buy X nor repeat stuff he already did/select during the FindA dialog.
Thanks in advance.
回答1:
I believe that the concept of SubActions might help you here. Take a look at this documentation topic to find more about how it work and some code highlights.
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.
来源:https://stackoverflow.com/questions/44331800/how-to-jump-from-one-intent-to-another-in-luisactiondialog-passing-context