QnaMakerDialog 尝试次数过多
QnaMakerDialog too many attempts
我使用 pakage qna maker 开发了一个机器人,我需要更改 tooManyAttempts 资源的标签,因为在法语中它不是最好用的词。
我可以更改资源吗?或者我可以跟踪 tooManyAttempts 变量来更改他的值吗?
感谢您的帮助
如果您查看 Github (here) 上 QnAMakerDialog
的实现,您会发现消息在此处声明:
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);
}
可以看到,抛出TooManyAttemptsException
时发送的消息在包的Resources中:Resource.Resource.tooManyAttempts
。
您可以考虑重写该方法,但您很快就会面临必须引用未定义方法的问题:此处 ResumeAndPostAnswer
被定义为私有的,因此不可见。
因此,不幸的是,解决方案之一是从 GitHub 项目中获取所有必要的资源(也就是说获取几乎所有 QnAMakerDialog 实现)
我使用 pakage qna maker 开发了一个机器人,我需要更改 tooManyAttempts 资源的标签,因为在法语中它不是最好用的词。 我可以更改资源吗?或者我可以跟踪 tooManyAttempts 变量来更改他的值吗?
感谢您的帮助
如果您查看 Github (here) 上 QnAMakerDialog
的实现,您会发现消息在此处声明:
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);
}
可以看到,抛出TooManyAttemptsException
时发送的消息在包的Resources中:Resource.Resource.tooManyAttempts
。
您可以考虑重写该方法,但您很快就会面临必须引用未定义方法的问题:此处 ResumeAndPostAnswer
被定义为私有的,因此不可见。
因此,不幸的是,解决方案之一是从 GitHub 项目中获取所有必要的资源(也就是说获取几乎所有 QnAMakerDialog 实现)