QnAMaker Dialog Fallback action
See original GitHub issueHi, 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:
- Created 3 years ago
- Comments:7
Top GitHub Comments
Hi @v-kydela , I changed my code according to the posts you suggested, this is the result:
The solution works, thanks for your support.
About the feature request, I opened a new one here.
@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.