我与许多人处在相同的情况下,在其中触发一个ChoicePrompt,然后LUIS将我从WaterfallDialog中带出,并试图将所选的选择与我的意图之一进行匹配。我已经看到很多关于同一问题的文章,许多解决方案都涉及在对话框栈中使用LuisRecognizer.onEnabled()
禁用对LUIS的调用。但是,必须在v4 SDK中对此进行更改,因为LuisRecognizer类(https://docs.microsoft.com/en-us/dotnet/api/microsoft.bot.builder.ai.luis.luisrecognizer?view=botbuilder-dotnet-stable)中不再存在此方法。我看到一个没有使用状态的解决方案,但是在Startup.cs
中,我有一个MemoryStorage
,并将其传递给了我认为正确的位置:
public void ConfigureServices(IServiceCollection services)
{
services.AddBot<BasicBot>(options =>
{
...
IStorage dataStore = new MemoryStorage();
var conversationState = new ConversationState(dataStore);
options.State.Add(conversationState);
var userState = new UserState(dataStore);
options.State.Add(userState);
services.AddSingleton(sp => new BotServices(botConfig));
services.AddSingleton<BotAccessors>(sp =>
{
var options = sp.GetRequiredService<IOptions<BotFrameworkOptions>>().Value;
var accessors = new BotAccessors(conversationState, userState)
{
CommandState = userState.CreateProperty<string>(BotAccessors.CommandStateName),
ConversationDialogState = conversationState.CreateProperty<DialogState>(BotAccessors.DialogStateName),
};
return accessors;
});
services.AddSingleton(sp =>
{
var section = this.Configuration.GetSection("Luis");
var luisApp = new LuisApplication(
applicationId: "2d...",
endpointKey: "64...",
endpoint: "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/")
var luisPredictionOptions = new LuisPredictionOptions
{
IncludeAllIntents = true,
};
return new LuisRecognizer(
application: luisApp,
predictionOptions: luisPredictionOptions,
includeApiResults: true);
});
}
通过这种配置,当我仅想在提示后转到瀑布对话框的下一步时,仍然会遇到Luis中断的情况。有人有见识吗? 感谢您的帮助。