New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LUIS] Prompt response starts new dialog with LUIS recognizer. #2670
Comments
For reference, it looks like the guy in #424 was having the same issue as I am on a much older version. Never seems to have been fixed/addressed. |
That's probably how it is designed to work. As I see you have a recognizer at bot level (you can also have them on library and dialog levels). When the bot handles a response (even during a prompt dialog) it needs to know where to route it and that's when all root recognizers are run. That's also where your triggerAction comes to play - it becomes a root intent handler which can be triggered any time your root recognizer returns "send" intent. And there's a special fallback route named "ActiveDialog", which is just one of the outcomes of the routing process, and only that will route the message to the prompt dialog you've previously started.
|
@delight-by, I recognize only one, very simple intent via the LUIS model. I have tried configuring the recognizer both at the bot level and at the IntentDialog level. Here is the alternate version that suffers from the same issues: const recognizer = new builder.LuisRecognizer(config.get('bot.model'))
this.intents = new builder.IntentDialog({
recognizers: [recognizer],
recognizeOrder: builder.RecognizeOrder.series
})
this.intents.matches('send', '/send')
this.intents.onDefault((session) => this.help(session))
this.dialog('/', this.intents)
this.dialog('/send', [(session, context, next) => {
const amount = builder.EntityRecognizer.findEntity(context.entities, 'builtin.currency')
const recipient = builder.EntityRecognizer.findEntity(context.entities, 'recipient')
const product = builder.EntityRecognizer.findEntity(context.entities, 'product')
session.send('Sure, I can do that.')
session.beginDialog('/send/product', product ? product.entity : null)
}, (session) => {
console.log('hello')
}])
this.dialog('/send/product', [(session, query, next) => {
if (query) {
session.dialogData.productQuery = query
next()
} else {
builder.Prompts.text(session, 'What type of gift card did you want to send?')
}
}, (session, results) => {
if (results && results.response) {
session.dialogData.productQuery = results.response
}
session.sendTyping()
ProductService.search(session.dialogData.productQuery).then(products => {
if (!products.length) {
session.send('Sorry, I couldn\'t find any products by that name.')
session.replaceDialog('/send/product')
}
const attachments = products.map(product => {
const image = builder.CardImage.create(session, product.configuration.image)
const valueLine = `$${product.value.min} - $${product.value.max}`
const card = new builder.HeroCard(session)
.title(product.name)
.images([image])
.text(product.description)
.subtitle(valueLine)
.tap(builder.CardAction.postBack(session, product.id))
return card
})
const message = new builder.Message(session)
.text('Okay, I found the following products. Please select the one you\'d like to send.')
.attachments(attachments)
.attachmentLayout(builder.AttachmentLayout.carousel)
builder.Prompts.text(session, message)
}).catch((err: Error) => {
session.error(err)
})
}, (session, response, next) => {
console.log(response)
}]) Also, I'm not seeing how this should be intended behaviour. If the recognizer is used to match the original intent, that intent spawns a dialog, then every subsequent dialog/prompt should be in the context of that original dialog. The most basic LUIS example given in the documentation shows setting up an alarm in a similar fashion. The intent is used to initiate the dialog but then they use prompts to gather additional user information. How would this be different? What am I doing wrong? |
That should be true if you're not using recognizers at bot/library levels. I haven't run your code, but visually it looks right. What problem do you have with it now? Also, have you tried 3.8.0 beta? They completely redesigned Prompts there. But from my experience it has a bug when a prompt doesn't recognize an utterance (e.g. a number prompt and not-a-number response) - it is spamming with a WARNs about not being able to match null intent (but it is just a WARN, otherwise it was working correctly). Install as botbuilder@3.8.0-beta8. |
@delight-by, the problem I have is that when it reaches any of the prompts, instead of the user's response being associated with that prompt it is evaluated as a new intent. It should be passed to the next waterfall step in that dialog as the I'll give 3.8.0 a try. |
@delight-by, same issue persists with 3.8.0 |
@dkushner It looks like your question was answered on Stack Overflow - do you require additional assistance? |
As stated above, trigger actions will trigger a new instance of a dialog anytime the user says something matching a given intent. This is generally desirable but if you don't want this behavior you have a couple of options. You could use an In 3.8 I added the ability to customize recognizers using new
|
@Stevenic what do you think about a function to enable/disable LUIS recognizer? |
Your desired behaviour can be achieved with "onSelectAction". Have a look here: |
Pre-flight checklist
botframework
.System Information
Issue Description
Prompt in LUIS intent dialog attempts to start a new dialog rather than resume the suspended dialog that began the prompt.
http://stackoverflow.com/questions/43712861/how-can-i-properly-prompt-a-user-without-having-luis-attempt-to-recognize-the-re
Example Code
Bot Setup
Dialog Setup
Steps to Reproduce
Expected Behavior
Resuming the suspended dialog and passing the user response to the next waterfall step.
Actual Results
Bot attempts to start a brand new dialog based on its attempts to match the intent of the user's response.
The text was updated successfully, but these errors were encountered: