question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

QnAMaker Dialog Fallback action

See original GitHub issue

Hi, QnA Maker Dialog component allows to easily connect a knowledge base. If a response score is less of a threshold set, a fallback answer is to throw, but there is no way to run a fallback action in substitution of the fallback answer.

The only way is not to use the QnAMaker component and implements yourself, using the HTTP component, the interaction with the KB. This solution requires managing other aspects, like the prompts answers, as suggested here. But “SuggestedActions” create a list not easy to scroll where there are a lot of values, so I wrote an adaptive card that contains a “TextBlock” and a dynamic list of buttons of type “Action.Submit”, this is the code:

# getResponseWithPrompts(answer, prompts)
-```
{
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.2",
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "text": "${answer}",
            "wrap": true
        }
    ],
    "actions": [
       ${getButtonList(prompts)}
    ]
}
```
# getButtonList(prompts)
- ${join(foreach(prompts, u, getButtonItem(u.displayText)), ',')}
# getButtonItem(value)
-```
{
    "type": "Action.Submit",
    "data": "${value}",
    "title": "${value}"
}
```

and I call the card with this snip of code:

[Activity
    Attachments = ${json(getResponseWithPrompts(dialog.api_response.content.answers[0].answer, dialog.api_response.content.answers[0].context.prompts))}
]

Problem: the card works well on Bot Framework Emulator and on test web chat of Bot Channel Registration, but give an issue on Teams. When I press the button, a blank value is submitted. Do you have suggestions for this problem?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
DanieleS82commented, Feb 2, 2021

Hi @v-kydela , I changed my code according to the posts you suggested, this is the result:

....
# getButtonList(prompts)
- ${join(foreach(prompts, u, if(turn.Activity.channelId == 'msteams' ,getButtonItemTeams(u.displayText, u.id) ,getButtonItemWeb(u.displayText, u.id))), ',')}
# getButtonItemTeams(value, id)
-```
{
    "type": "Action.Submit",
    "id": "${id}",
    "title": "${value}",
    "data": {
        "msteams": {
            "type": "imBack",
            "value": "${value}"
        }
    }
}
```
# getButtonItemWeb(value, id)
-```
{
    "type": "Action.Submit",
    "id": "${id}",
    "title": "${value}",
    "data": "${value}"
}
```

The solution works, thanks for your support.

About the feature request, I opened a new one here.

0reactions
v-kydelacommented, Feb 1, 2021

@DanieleS82 - The problem you reported here was about an Adaptive Card not working in Teams even though it works in Web Chat. There is no discernable feature request in this issue, but you can feel free to post a feature request if you’d like.

Keep in mind that Composer just uses the QnAMakerDialog class in the Bot Builder .NET SDK, so if your feature request is that you’d like QnA Maker dialogs to allow fallback actions, you might consider posting that in the Bot Builder .NET repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tutorial: Integrate with Power Virtual Agents - QnA Maker
This section creates the fallback topic conversation flow. The new fallback action might already have conversation flow elements. Delete the ...
Read more >
QnA Maker Dialog for Bot Framework - Gary Pretty
The QnAMakerDialog allows you to take the incoming message text from the bot, send it to your published QnA Maker service and send...
Read more >
Is it possible to trigger dialogs or responses based on ...
I am using Bot Framework Composer - v2.1.0 and QnAMaker dialog (Microsoft.QnAMakerDialog). Please refer to the attached screenshot.
Read more >
Best practices - Microsoft Open Source
Developing a dialog ... protected async Task<DialogTurnResult> SendFallback(WaterfallStepContext sc, CancellationToken ... PromptAsync(Actions.
Read more >
Create a QnA Bot Using QnA Maker and Power Virtual Agents ...
This video walks you through using integrating QnA Maker with your Power Virtual Agents Bot in Teams to give your bot personality and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found