在luis对话框中的每个意图之后如何调用特定意图

时间:2018-09-10 12:54:17

标签: c# botframework luis

我正在创建一个luis对话框。

我想在每个上下文对话框完成后显示菜单。 而不是context.Wait(MessageReceived),我尝试创建称为菜单的新意图(问候菜单的克隆),并在每个意图之后显示该意图。

这是我的代码:

 public class LuisDialog : LuisDialog<object>
{

    [LuisIntent("Greeting")]
    public async Task Greeting(IDialogContext context, LuisResult result)
    {

        var cardmessage = context.MakeMessage();
        cardmessage.Attachments = new List<Attachment>();
        CardAction ca = new CardAction()
        {
            Title = "one",
            Type = ActionTypes.ImBack,
            Value = "one"
        };
        CardAction ca2 = new CardAction()
        {
            Title = "two",
            Type = ActionTypes.ImBack,
            Value = "two"
        };

        HeroCard herocard = new HeroCard()
        {
            Title = "one",
            Subtitle = "Please select/type one of the services",
            Images = new List<CardImage> { new CardImage("xxx") },
            Buttons = new List<CardAction>()
        };
        herocard.Buttons.Add(ca);
        herocard.Buttons.Add(ca2);


        cardmessage.Attachments.Add(herocard.ToAttachment());

        await context.PostAsync("Choose one");

        await context.PostAsync(cardmessage);

        }
    }
 [LuisIntent("")]
    public async Task None(IDialogContext context, LuisResult result)
    {
        await context.PostAsync("I could not understand. Please rephrase your sentence");
        context.Wait(MessageReceived);

0 个答案:

没有答案