Ich baue einen Bot mit dem Microsoft Bot Framework, V3, in C# und versuche, den Dialog zu starten und den Benutzer mit Anweisungen zu "begrüßen", bevor sie irgendeine Eingabe eingeben. Ich möchte auch, dass der Dialog jedes Mal wiederholt wird, wenn der Benutzer das Formular ausfüllt.Startdialog ohne Eingabeaufforderung in Bot (für C#)
Ich versuche, die FormFlow-Optionen zu verwenden: FormOptions.PromptInStart, aber es wird immer noch die Willkommensnachricht angezeigt, erst nachdem sie einige Eingaben eingegeben haben. Nicht sicher, ob dies mit V1 veraltet ist oder ich mache es einfach nicht richtig. Irgendein Rat??
sind meine Klassen wie folgt:
MessagesController:
internal static IDialog<MyClass> MakeRootDialog()
{
return Chain.From(() => FormDialog.FromForm(MyClass.BuildForm, options: FormOptions.PromptInStart))
.Do(async (context, order) =>
{//some actions here }
});
}
MyClass.cs:
[Serializable]
public class MyClassDialog : IDialog<object>
{
public async Task StartAsync(IDialogContext context)
{
context.Wait(MessageReceivedAsync);
}
public async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> argument)
{
var message = await argument;
await context.PostAsync("You said: " + message.Text);
context.Wait(MessageReceivedAsync);
}
}
MyClassDialog.cs:
public class MyClass
{
public static IForm<MyClass> BuildForm()
{
OnCompletionAsyncDelegate<MyClass> processOrder = async (context, state) =>
{
await context.PostAsync("We are currently filing your order.....");
};
return new FormBuilder<MyClass>()
.Message("Welcome to my bot!")
//some actions here
.Confirm(//more actions here)
.AddRemainingFields()
.Message("Thanks for providing your inputs")
.OnCompletion(processOrder)
.Build();
}
};
Ja, überprüfen wir waren Testen mit Emulator, aber hatten das gleiche Problem in WebChat. Es war ein Problem mit unserer Dialog-Klasse. – kgonzal3