Search code examples
botframeworkazure-qna-maker

How to change the default answer in QnA Maker?


I need to change the default answer in the QnA Maker. I changed it in the configuration of the QnA App Service as seen here:

default answer app config

When I try it in the QnA Maker Portal I get the new default answer:

portal default answer

The problem is that when I try it in a channel like Microsoft Teams(or any other one), the default answer is not the new default answer:

Micosoft Teams default answer

My Microsoft Teams version is 1.2.00.27559 (64-bit)


Solution

  • To change the default answer of a QnA Bot in a channel like Microsoft Teams, we have to change it in its source code. To access the source code, head to the Bot App Service and in the left hand blade look for the App Service Editor in the Development Tools tab:

    Once there, we have to look for the Dialog folder and open up the QnAMakerBaseDialog file:

    Now, we have to edit the DefaultNoAnswer const:

    Then, we have to build the solution in the code editor. To do that, click the console icon on the left vertical menu, type "build.cmd" in the console and hit enter. This action should build and deploy your code.

    If you have any issues building it this way, you can build it also from the App Service panel, going to Console, under the Development Tools tab(where the App Service Editor was)

    Finally, the default answer should be displayed correctly. If not, restart the app service in the Azure portal and the new default answer should work fine!