从LuisDialog转发到IDialog时的MultipleResumeHandlerExeption

时间:2017-12-06 12:04:09

标签: dialog bots luis

亲爱的程序员,您好

我正在尝试将我的LuisBot转换为MultiDialog应用程序。但是我收到错误消息“Exception:IDialog方法执行完成了通过IDialogStack指定的多个简历处理程序。”当我输入“帮助”时,从botframework模拟器中。 bot Framework Emulator errormessages 这是什么意思?我在下面包含了一些我的BotCode,如果你在某个地方看到问题,请指出给我。 MessagesController启动一个新的LuisDialog,它具有以下两个函数(admidst others):

    [LuisIntent("Utilities.Help")]
        public async Task HelpIntent(IDialogContext context, LuisResult result)
    {
                    await context.PostAsync($"You have reached the help intent. You said: {result.Query}"); 

        IMessageActivity message = Activity.CreateMessageActivity();
        message.Text = result.TopScoringIntent.Intent+ "Willkommmen";
        message.TextFormat = "plain";
        message.Locale = "de";

        context.Wait(MessageReceived);
        //reference: https://github.com/Microsoft/BotBuilder-Samples/blob/master/CSharp/core-MultiDialogs/Dialogs/RootDialog.cs
        await context.Forward(new HelpDialog(),AfterDialog, message, CancellationToken.None);
    }

    private async Task AfterDialog(IDialogContext context, IAwaitable<object> result)
    {

        var ticketNumber = await result;
        await context.PostAsync($"Thanks for contacting our support team. Your ticket number is {ticketNumber}.");

        context.Wait(MessageReceived);
    }

HelpIntent-Function应该调用HelpDialog,但我认为没有达到或正确执行HelpDialog中的startAsyc()。 HelpDialog看起来像这样:

[Serializable]
    public class HelpDialog : IDialog<object>
    {
        public async Task StartAsync(IDialogContext context)
        {
            context.Wait(this.MessageReceivedAsync); 
        }


        public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> result)
        {
            var message = await result;

            var ticketNumber = new Random().Next(0, 20000);

            await context.PostAsync($"Your message '{message.Text}' was registered. Once we resolve it; we will get back to you.");

            context.Done(ticketNumber);
        } 

我已经尝试在VS中调试整个事情,但是在创建LuisDialog时,抛出异常的行是在MessagesController中。不知怎的,我无法介入,所以我不是更聪明。我想,我的一个ResumeHandler是AfterDialog(),但是另一个可能是什么?在LuisDialog中,只有intent-functions和一个resume函数。 [Serializable]也在LuisDialog中设置。我还能检查什么?

0 个答案:

没有答案