1

The bot is created with QnA maker and integrated with Microsoft teams. The knowledge base has many questions and answer pairs but the default answer only accepts text when editing it in azure portal here: myBot.scm.azurewebsites.net/dev/wwwroot/Dialog/QnAMakerBaseDialog.cs. What it needs to do is to display the default answer when it finds no answer in QnA KB, in form of a hyperlink instead of plain text but I am not able to find any option where I can do that.

This is the main line that I am trying to modify for display.

public const string DefaultNoAnswer = "Sorry, I couldn't find an answer, please write your query in the ***form*** *(https://www.forms.office.com)* to be added in bot QnA Maker knowledge base";

namespace Microsoft.BotBuilderSamples.Dialog
{
    /// <summary>
    /// QnAMaker action builder class
    /// </summary>
    public class QnAMakerBaseDialog : QnAMakerDialog
    {
        // Dialog Options parameters
        public const string DefaultNoAnswer = "Sorry, I couldn't find an answer, please write your query in the ***form*** *(https://www.forms.office.com)* to be added in bot QnA Maker knowledge base";
        public const string DefaultCardTitle = "Did you mean:";
        public const string DefaultCardNoMatchText = "None of the above.";
        public const string DefaultCardNoMatchResponse = "Thanks for the feedback.";

        private readonly MyBot;

        /// <summary>
        /// Initializes a new instance of the <see cref="QnAMakerBaseDialog"/> class.
        /// Dialog helper to generate dialogs.
        /// </summary>
        /// <param name="services">Bot Services.</param>
        public QnAMakerBaseDialog(IBotServices services): base()
        {
            this._services = services;
        }

        protected async override Task<IQnAMakerClient> GetQnAMakerClientAsync(DialogContext dc)
        {
            return this._services?.QnAMakerService;
        }

        protected override Task<QnAMakerOptions> GetQnAMakerOptionsAsync(DialogContext dc)
        {
            return Task.FromResult(new QnAMakerOptions
            {
                ScoreThreshold = DefaultThreshold,
                Top = DefaultTopN,
                QnAId = 0,
                RankerType = "Default",
                IsTest = false
            });
        }
Kyle Delaney
  • 11,616
  • 6
  • 39
  • 66

1 Answers1

0

Modify the QnA Knowledge base record, for which contains the HTML link, change it to the format below:

"Show your <b><font color=blue><a href=""https://www.microsoft.com"">Link here</a></font></b>."

You may add other HTML tags to customize the text.

In the markdown format, Bold URL for link:

[**text**](https://www.my.com)  

Example Code: `

How do I create a bot with [**QnA Maker**](https://www.qnamaker.ai)?    format for bold URL`

Display: How do I create a bot with QnA Maker? format for bold URL

KarthikBhyresh-MT
  • 4,560
  • 2
  • 5
  • 12