0
votes

Hy, for my Bot I need to call a second LUIS dialog instance. But with the Forward function in the first LUIS dialog only normal dialogs work. The intent recognition doesn't work.

So how can I call a new second LUIS dialog in the first LUIS dialog?

MessagesController:

await Conversation.SendAsync(activity, () => new FirstDialogClass());

FirstDialogClass:

[LuisModel("luis", "key")]
[Serializable]
public class FirstDialogClass: LuisDialog<object>
{
    [LuisIntent("")]
    public async Task None(IDialogContext context, LuisResult result)
    {
        await context.PostAsync("intension first dialog: none");
        // call second luis instance
        await context.Forward(new SecondDialogClass(), CallbackFirstDialog, "message", CancellationToken.None);
    }


    [LuisIntent("Greeting")]
    public async Task Hallo(IDialogContext context, LuisResult result)
    {
        await context.PostAsync("intension first dialog: greeting");
        context.Wait(MessageReceived);
    }


    private async Task CallbackFirstDialog(IDialogContext context, IAwaitable<object> result)
    {
        await context.PostAsync("callback first dialog");
        context.Wait(MessageReceived);
    }
}

SecondDialogClass:

[LuisModel("luis", "key")]
[Serializable]
public class SecondDialogClass : LuisDialog<object>
{
    [LuisIntent("")]
    public async Task None(IDialogContext context, LuisResult result)
    {
        await context.PostAsync("intension second dialog: none");
        context.Done(new Object());
    }


    [LuisIntent("Alphabet")]
    public async Task Alphabet(IDialogContext context, LuisResult result)
    {
        await context.PostAsync("intension second dialog: alphabet");
        context.Done(new Object());
    }
}
1
Please, mention the exception what you got, after calling the second dialog.OmG
There is no exception. It doesn't call the intent function. I have found my problem. (see answer)Robert

1 Answers

2
votes

I found a solution myself.

[LuisIntent("")]
public async Task None(IDialogContext context, LuisResult result)
{
    await context.PostAsync("intension first dialog: none");
    // call second luis instance
    var message = context.MakeMessage();    // create a message
    message.Text = "abc";   // alphabet intension is called
    await context.Forward(new SecondDialogClass(), CallbackFirstDialog, message, CancellationToken.None);
}