简体   繁体   English

Microsoft BotFramework FormFlow PromptInStart跳至功能后的恢复

[英]Microsoft BotFramework FormFlow PromptInStart skips to the resume after function

I'm trying to start a FormFlow from a LuisDialog: 我正在尝试从LuisDialog启动FormFlow:

[LuisIntent("bookConfRoom")]
public async Task BookConferenceRoom(IDialogContext context, LuisResult result)
{
     IDialog<RoomBooking> roomBookingDialog = MakeRootDialog();
     context.Call(roomBookingDialog, RoomBookingComplete);
}

MakeRootDialog() builds the FormFlow form: MakeRootDialog()构建FormFlow表单:

internal static IDialog<RoomBooking> MakeRootDialog()
{
     return Chain.From(() => 
        FormDialog.FromForm(RoomBooking.BuildForm, options: FormOptions.PromptInStart));
}

And RoomBooking looks like this: RoomBooking看起来像这样:

[Serializable]
public class RoomBooking
{
    public LocationOptions MeetingLocation;
    public DateTime MeetingTime;
    public double NumberOfHours;
    public int NumberOfAttendees;
    public List<AmenitiesOptions> Amenities;

    public static IForm<RoomBooking> BuildForm()
    {
        return new FormBuilder<RoomBooking>().Build();
    }
}

When that intent is hit the resume after function RoomBookingComplete runs immediately without the FormFlow appearing. 当该意图被击中后, RoomBookingComplete函数将立即运行而不会出现FormFlow,然后继续运行。 However if I remove FormOptions.PromptInStart then the FormFlow does run, but you have to send another message to the bot before it starts, which is what I thought PromptInStart would fix? 但是,如果我删除FormOptions.PromptInStart那么FormFlow会运行, 但是您必须在启动之前向机器人发送另一条消息,这就是我认为PromptInStart可以解决的问题?

I think I'm getting confused with the order of the Dialog stack and/or which dialog context I'm in. Any help will be appreciated. 我认为我对Dialog堆栈的顺序和/或我所处的对话框上下文感到困惑。任何帮助将不胜感激。

You should remove the Chain.From 您应该删除Chain.From

internal static IDialog<RoomBooking> MakeRootDialog()
{
     return FormDialog.FromForm(RoomBooking.BuildForm, options: FormOptions.PromptInStart));
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM