问题
I have multiple dialogs that are triggered with triggerAction
. I use LUIS to trigger/match utterances to specific dialogs.
Each dialog has two steps (functions):
- if entities are valid query DB and end dialog, else prompt user for one of the missing entities with
Prompts.text()
and continue to next step - set dialog state and repeat dialog from step 1 with
next()
*
My problem is that for some prompted inputs (i.e. entity values) LUIS will trigger new unrelated dialogs. In these cases the dialog stack is lost (since I use triggerAction
) and the conversation flow is broken.
How can I ensure that the prompt for missing entities will not trigger a new dialog? Is my conversation flow flawed?
I already have many trained utterances for each intent. I'm guessing my LUIS model is "loose" enough to match multiple word entities (entered after the prompt) to (short) intent utterances.
* From the docs: When a bot reaches the end of the waterfall without ending the dialog, the next message from the user will restart that dialog at step one of the waterfall.
回答1:
You can use LuisRecognizer.onEnabled()
to disable your LUIS calls while you're in the middle of a dialogStack, or even in the middle of a dialog. This will solve the issue of intents being recognized while you're in the middle of a Prompt.
Here's an example I wrote on implementing the method when using a RegExpRecognizer
(.onEnabled()
is inherited from IntentRecognizer
).
Here's an answer to a Stack Overflow question that I wrote.
来源:https://stackoverflow.com/questions/46434170/how-to-use-prompts-text-without-triggering-new-intent-in-microsoft-bot-framework