1

I want to call a LUIS dialog from outside of MessagesController class. I create a root Dialog in my MessageController class:

 if (activity.Type == ActivityTypes.Message) {
 await Conversation.SendAsync(activity, () => new MessageDialogHandler());

In my MessageDialogHandler class I'm handling Attachments and Text input.

if (activity.Attachments?.Count() > 0) {
            FaceAnalysis faceAnalysis = new FaceAnalysis();
            await faceAnalysis.AnalyseImageAsync(context, argument);
        }
else if(activity.Text.Length > 0) {
//here needs to be the code to call a LUIS dialog.
}

I have a standard LUIS class:

[LuisModel("App-ID", "SubscriptionKey")]
[Serializable]

public class LuisDialog : LuisDialog<object> {

How do I manage to call that LUIS Dialog from my MessageDialogHandler class? Yes I did read this post Link but it didn't help me.

Thanks for any ideas.

Community
  • 1
  • 1
Soeren
  • 247
  • 2
  • 11

1 Answers1

1

You just need to do a context.Forward of the message to the LuisDialog.

await context.Forward(
      new LuisDialog(), 
      LuisDialogCompleted, 
      activity, 
      System.Threading.CancellationToken.None);

To understand more around how to call dialogs, please refer to this.

Community
  • 1
  • 1
Ezequiel Jadib
  • 14,767
  • 2
  • 38
  • 43