Bot框架中的同义词功能无法正常工作。在下面的代码行中,如果使用情况输入了新的/新的案例,则应得出value =“ Create new case”。到目前为止,只有创建新案例会进入正确的对话框,而新案例/新案例会导致漫游器无法理解用户的需求。
private static async Task<DialogTurnResult> ChoiceCardStepAsync(WaterfallStepContext step, CancellationToken cancellationToken)
{
// Create options for the prompt
Activity activity = step.Context.Activity;
var options = new PromptOptions()
{
Prompt = activity.CreateReply("What would you like to do?"),
Choices = new List<Choice>(),
};
// Add the choices for the prompt.
options.Choices.Add(new Choice() { Value = "Check case status" , Synonyms = new List<string> { "status", "case status", "check case" }});
options.Choices.Add(new Choice() { Value = "Create new case" , Synonyms = new List<string> { "new", "new case" } });
options.Choices.Add(new Choice() { Value = "Look for an agent" });
options.Choices.Add(new Choice() { Value = "End Conversation" });
return await step.PromptAsync("cardPrompt", options, cancellationToken);
}
`WaterfallStep[] steps = new WaterfallStep[]
{
ChoiceCardStepAsync,
HandleChoiceAsync,
LoopBackAsync,
}
_dialogs = new DialogSet(_accessors.DialogStateAccessor)
.Add(new WaterfallDialog(MainDialogId, steps))
.Add(new CheckCaseStatusDialog(CheckCaseStatusDialogId))
.Add(new NewCaseDialog(NewCaseDialogId))
.Add(new ChoicePrompt("cardPrompt") {Style = ListStyle.SuggestedAction });`
我已经检查了Microsoft文档,并且仍可用于bot框架V4,但是我不确定为什么它没有效果。任何人都可以启发我了解我所缺少的东西吗?