I have a Microsoft azure virtual assistant set up but without connecting to Luis and not deployed yet.
In qnamaker website, it was successfully doing multi-turn follow up buttons but not on the bot emulator.
I was wondering if this was caused by not set up and deploy the virtual assistant in the first place. Because the default greeting card was even failed to show when the virtual assistant was created.
Am I missing some code to display those follow up prompt buttons or is it impossible because Luis is not connected and deployment not set up? If I am missing some code can someone point me to right direction?
Note: this is a virtual assistant and not a bot. They are similiar but the tutorial for bots didn't work on the virtual assistant. I'm using the latest virtual assistant template. I did a lot of research but couldn't solve it. I have been spending 2 days on this.
Thank you
The multi-turn feature is a feature that can be turned on in the portal qnamaker.ai, however your bot is still responsible for handling sending messages that have cards with buttons attached.
generateanswer
API to return responses with a "context
" object that includes prompts
values.You can find an example of a bot implementing multi-turn prompts in the botbuilder samples
repo, 70.qnamaker-multiturn-sample
. The snippet where it builds the card, I'll post below, but I would advise going to the sample directly to look at the logic around it, to get an idea of when you want to actually send a message with a card (they do it by sending cards only if context
and prompt
are present--you can customize it to how you need for your bot).
/// <summary>
/// Get multi-turn prompts card.
/// </summary>
/// <param name="result">Result to be dispalyed as prompts.</param>
/// <returns>IMessageActivity.</returns>
private static IMessageActivity GetQnAPromptsCardWithoutNoMatch(QueryResult result)
{
if (result == null)
{
throw new ArgumentNullException(nameof(result));
}
var chatActivity = Activity.CreateMessageActivity();
chatActivity.Text = result.Answer;
var buttonList = new List<CardAction>();
// Add all prompt
foreach (var prompt in result.Context.Prompts)
{
buttonList.Add(
new CardAction()
{
Value = prompt.DisplayText,
Type = "imBack",
Title = prompt.DisplayText,
});
}
var plCard = new HeroCard()
{
Buttons = buttonList
};
// Create the attachment.
var attachment = plCard.ToAttachment();
chatActivity.Attachments.Add(attachment);
return chatActivity;
}
I haven't looked at the Virtual Assistant solutions project in a while, but I would say check to make sure that they don't have a multi-turn QnA dialog already to verify that this is the issue, and if so, look at the multi-turn qna sample to see an example of how you can edit your VA to include handling multi-turn prompts.