0
votes

I'm looking for ways to catch a Qna Maker no match event and then handle it in a customized way. My current Qna Dialog goes like this :

[Serializable]
public class QnaMakerDialog : QnAMakerDialog
{
    public QnaMakerDialog() : base(new QnAMakerService(new QnAMakerAttribute(<<myQnAAuthKey>>, <<myQnAKnowledgebaseId>>, "Answer not found. Please try it again", 0.5, 1, <<myQnAEndpointHostName>>)))
{
}
    protected override async Task RespondFromQnAMakerResultAsync(IDialogContext context, IMessageActivity message, QnAMakerResults result)
{
...
}
}

The no match custom message works fine when QnA Maker cannot find an answer to a given question. However, I'd like to intercept the event and then log the "no matched" answer on the database.

Thanks in advance, Amintas

1
Please separate the code from text by using the code formatting button {}. That will make the question more readable. - user15741

1 Answers

2
votes

you can use NoMatchhandler method for this.

 public class BotFrameworkFaQDialog:QnAMakerDialog<object>
{
    public override async Task NoMatchHandler(IDialogContext context, string originalQueryText)
    {
        await context.PostAsync($"Sorry i could't find answer for {originalQueryText} .");
        context.Wait(MessageReceived);
    }
}