我开发了一个使用pakage qna制造商的机器人,我需要更改tooManyAttempts资源的标签,因为在法语中它不是最常用的词。我可以更改资源吗?或者我可以跟踪tooManyAttempts var来改变他的值吗?
谢谢你的帮助
如果您在Github(QnAMakerDialog
)上查看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);
}
如您所见,抛出TooManyAttemptsException
时发送的消息位于包的资源中:Resource.Resource.tooManyAttempts
。
您可以考虑覆盖该方法,但您很快就会面临必须引用未定义方法的问题:这里ResumeAndPostAnswer
被定义为私有,因此不可见。
因此,遗憾的是,其中一个解决方案是从GitHub项目中获取所有必要的资源(也就是说几乎可以获得所有QnAMakerDialog实现)