2

I developed a bot using pakage qna maker and I need to change the label for the tooManyAttempts ressource because in french it's not the best word used. Can I change the ressource ? Or Can I tracked the tooManyAttempts var to change his value ?

Thanks you for your help

Nicolas R
  • 13,812
  • 2
  • 28
  • 57
Rate Reality
  • 43
  • 1
  • 5
  • You added the [chatbot] tag, are you using [botframework]? Which tooManyAttemps label are you talking about, the one when you are selecting a value when several are matching? – Nicolas R Mar 02 '18 at 15:06
  • Yes I use the botframework. I talking about that. I can not intercept it – Rate Reality Mar 03 '18 at 19:05

1 Answers1

0

If you have a look to the implementation of QnAMakerDialog on Github (here), you will find that the message is declared here:

protected virtual async Task QnAFeedbackStepAsync(IDialogContext context, QnAMakerResults qnaMakerResults)
{
    var qnaList = qnaMakerResults.Answers;
    var questions = qnaList.Select(x = >x.Questions[0]).Concat(new[] {
        Resource.Resource.noneOfTheAboveOption
    }).ToArray();

    PromptOptions < string > promptOptions = new PromptOptions < string > (
    prompt: Resource.Resource.answerSelectionPrompt, tooManyAttempts: Resource.Resource.tooManyAttempts, options: questions, attempts: 0);

    PromptDialog.Choice(context: context, resume: ResumeAndPostAnswer, promptOptions: promptOptions);
}

As you can see, the message sent when the TooManyAttemptsException is thrown is in the Resources of the package: Resource.Resource.tooManyAttempts.

You could think about overriding the method, but you will soon face the problem of having to reference undefined methods: here the ResumeAndPostAnswer is defined as private, so not visible.

So one of the solutions, sadly, would be to get all the necessary sources from the GitHub project (that is to say get almost all the QnAMakerDialog implementation)

Nicolas R
  • 13,812
  • 2
  • 28
  • 57