0

我正在尝试从 LuisDialog 启动 FormFlow:

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

MakeRootDialog()构建 FormFlow 表单:

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

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();
    }
}

当该意图被击中时,函数RoomBookingComplete立即运行而不会出现 FormFlow。但是,如果我删除FormOptions.PromptInStart,那么 FormFlow 确实会运行,但是您必须在机器人启动之前向它发送另一条消息,这就是我认为PromptInStart可以解决的问题?

我想我对对话框堆栈的顺序和/或我所在的对话框上下文感到困惑。任何帮助将不胜感激。

4

1 回答 1

0

你应该删除Chain.From

internal static IDialog<RoomBooking> MakeRootDialog()
{
     return FormDialog.FromForm(RoomBooking.BuildForm, options: FormOptions.PromptInStart));
}
于 2017-10-17T13:15:53.043 回答