как вызвать конкретное намерение после каждого намерения в диалоге luis - PullRequest
0 голосов
/ 10 сентября 2018

Я создаю диалог Луиса.

Я хочу показывать меню после каждого контекстного диалога. Вместо context.Wait (MessageReceived) я пытаюсь создать новое намерение с именем menu (клон меню приветствия) и показывать это намерение после каждого намерения.

Вот мой код:

 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);
...