No Examples of Conditional Dialogs?
So I have been reading over the examples (in C#) and I am not seeing any examples of how to conditionally decide which dialog to return. So as an example I have a bot that listens to all messages. If someone asks to tell a joke then I want to return the IFormDialog
The AlarmBot example binds to LUIS intents and then uses system dialogs depending on the intent that was selected--this sounds exactly like what you are looking for. If you grab the source code you can also see some examples of Conditional fields in a form in the FormTest project and also of two forms being hooked together.
I read over the LUIS but then you would have to create LUIS intents, I will look at the FormTest
You can do the same thing with a CommandDialog that uses regular expressions instead of LUIS.
Do you have an example of how to hook the CommandDialog up to the IFormDialog
If you look at the commit d2eb5b7, you can find a simple example of a bot that uses multiform dialogs.
@runxc1 Both the CommandDialog & LuisDialog classes are best thought of as switch statements which as Chris & Shahin suggest sound like exactly what you want. CommandDialog is nice because its RegEx based but the LuisDialog is way more flexible from a matching perspective. You just have to bite the built and learn LUIS.
The normal pattern we envision for most bots is a switch at the root (either a CommandDialog or LuisDialog) and then various other dialog types hung off the switch. The switch determines the initial intent, "tell a joke" or "what's the weather?" and then redirects to the appropriate Joke or Weather dialog.
Ok so what was throwing me off without examples was that all of the methods in the CommandDialog called for ResumeAfter
internal static IDialog ContextSwitch()
{
var cd = new CommandDialog();
cd.On(new Regex("Garmin Joke"), (x,y)=> { return FormDialog.FromForm(GarminJoke.BuildForm).StartAsync(x); });
return cd;
}
/// <summary>
/// POST: api/Messages
/// receive a message from a user and reply to it
/// </summary>
public async Task<Message> Post([FromBody]Message message)
{
if (message.Type == "Message")
{
return await Conversation.SendAsync(message, ContextSwitch);
}
else
{
return HandleSystemMessage(message);
}
}
The Nodejs documentation has more examples and shows how to use the CommandDialog but I am not seeing any examples on the CommandDialog. @Stevenic am I close or is it intended to be used much differently?
On a side note a lot of the dotnet teams (cli,roslyn,corefx) have created a https://gitter.im/ chat room associated with the Github repo and put a link on the information page for the repo... That could be of use here
Thanks for the suggestion on gitter. I've setup a BotBuilder room there. We will also work up some examples of CommandDialog.