1

I am trying to implement auto Question-suggestions Pop-Up in chatbot using Bot Framework in C#. how to keep multiple auto Question suggestions Pop-Up in a single row. when I enter the hi(text field) it gives the multiple suggestion(like hello, hey there,hi etc.) and click on suggestion it will auto complete it , It should be like Google suggestion.

I 'm implemented in C#,But it give suggestion with multiple answer.Here is below my sample code

[QnAMaker("set yout subscription key here", "set your kbid here", "I don't understand this right now! Try another query!", 0.50, 3)]
    public class QnABotWithCustomAnswer : QnAMakerDialog
    {
        protected override async Task QnAFeedbackStepAsync(IDialogContext context, QnAMakerResults qnaMakerResults)
        {
            // responding with the top answer when score is above some threshold
            if (qnaMakerResults.Answers.Count > 0 && qnaMakerResults.Answers.FirstOrDefault().Score > 0.75)
            {
                await context.PostAsync(qnaMakerResults.Answers.FirstOrDefault().Answer);
            }
            else
            {
                await base.QnAFeedbackStepAsync(context, qnaMakerResults);
            }
        }
}

Please Help me.

1 Answer 1

1

it give suggestion with multiple answer

In your code, we can find that you set top property (the number of answers to return) to 3, if you want your QnAMaker dialog return top 1 answer, you can set top property to 1.

[QnAMaker("{subscriptionKey_here}", "{ knowledgebaseId_here}", "I don't understand this right now! Try another query!", 0.50, 1)]

Here is the definition of QnAMakerAttribute, you can check it and know the details of each parameters:

// Summary:
//     Construct the QnA Knowledgebase information.
//
// Parameters:
//   knowledgebaseId:
//     The QnA Knowledgebase ID.
//
//   defaultMessage:
//     The default message returned when no match found.
//
//   scoreThreshold:
//     The threshold for answer score.
//
//   top:
//     The number of answers to return.
public QnAMakerAttribute(string authKey, string knowledgebaseId, string defaultMessage = null, double scoreThreshold = 0.3, int top = 1, string endpointHostName = null);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.