Code
[Serializable]
public class FAQConversation
{
[Prompt("What product is your concern? {||}")]
public VASetting.SupportedProducts Products { get; set; }
[Prompt("Okay, tell me what is your question. Enter \"back\" to go back to Products Selection.")]
public string Inquiry { get; set; }
public static IForm<FAQConversation> BuildForm()
{
return new FormBuilder<FAQConversation>()
.AddRemainingFields()
.Field(new FieldReflector<FAQConversation>(nameof(Inquiry)).SetValidate(AnswerInquiry))
.Message("Hi this is Test Virtual Assistant")
.Build();
}
private static async Task<ValidateResult> AnswerInquiry(FAQConversation state, object value)
{
var asString = value as String;
var vaConfig = new SmartCareSetting(state.Products);
var result = new ValidateResult() { IsValid = false, Value = value };
if (!string.IsNullOrEmpty(asString))
{
var luisService = new LuisService(new LuisModelAttribute(vaConfig.AppID, vaConfig.SubscriptionKey, domain: vaConfig.HostName));
var luisResult = await luisService.QueryAsync(asString, CancellationToken.None);
result.Feedback = luisResult.TopScoringIntent.Intent.ToString();
}
return result;
}
}
My bot code above shows the conversation below.
I am creating a simple inquiry bot using FormFlow
and Bot Framework.
I am validating the Inquiry
field through LUIS and returning the intent for processing. I am getting the correct intent, in this case is EXC01
. Afterwards, Im wondering why am I still getting prompted the Inquiry
prompt.
Questions:
1. How can I finish the FormFlow
after validating the Intent of the Inquiry?
2. I want to handle the returned Intent but not show it to the user. I'll be using the Intent string for querying to a Database. Can I do this inside the BuildForm()
?