Llame a LUIS desde FormFlow en C #
Estoy usando el marco de bot de Microsoft para crear un bot para interrogar al usuario y luego entender la respuesta. Se interroga al usuario utilizando la API FormFlow en el marco del bot y se recuperan las respuestas. Aquí está el código para el flujo de formulario:
public enum Genders { none, Male, Female, Other};
[Serializable]
public class RegisterPatientForm
{
[Prompt("What is the patient`s name?")]
public string person_name;
[Prompt("What is the patients gender? {||}")]
public Genders gender;
[Prompt("What is the patients phone number?")]
[Pattern(@"(<Undefined control sequence>\d)?\s*\d{3}(-|\s*)\d{4}")]
public string phone_number;
[Prompt("What is the patients Date of birth?")]
public DateTime DOB;
[Prompt("What is the patients CNIC number?")]
public string cnic;
public static IForm<RegisterPatientForm> BuildForm()
{
OnCompletionAsyncDelegate<RegisterPatientForm> processHotelsSearch = async (context, state) =>
{
await context.PostAsync($"Patient {state.person_name} registered");
};
return new FormBuilder<RegisterPatientForm>()
.Field(nameof(person_name),
validate: async (state, value) =>
{
//code here for calling luis
})
.Field(nameof(gender))
.Field(nameof(phone_number))
.Field(nameof(DOB))
.Field(nameof(cnic))
.OnCompletion(processHotelsSearch)
.Build();
}
}
El usuario puede ingresar cuando se le solicite el nombre:
mi nombre es James Bond
También el nombre podría ser de longitud variable. Sería mejor llamar a luis desde aquí y obtener la entidad (nombre) para la intención. Actualmente no sé cómo puedo llamar a un diálogo de luis desde el flujo de formulario.