// [START dialogflow_delete_intent] public static int Delete(string projectId, string intentId) { var client = IntentsClient.Create(); client.DeleteIntent(new IntentName(projectId, intentId)); Console.WriteLine($"Deleted Intent: {intentId}"); return(0); }
public ActionResult CriarIntencao() { Google.Cloud.Dialogflow.V2.IntentsClient c = IntentsClient.Create(); Intent intent = new Intent(); intent.DisplayName = "Curso.Nome"; var frase1 = new Intent.Types.TrainingPhrase(); frase1.Parts.Add(new Intent.Types.TrainingPhrase.Types.Part() { Text = "Qual o valor do curso de " }); frase1.Parts.Add(new Intent.Types.TrainingPhrase.Types.Part() { Text = "sistemas de informação", EntityType = "Cursos" }); var frase2 = new Intent.Types.TrainingPhrase(); frase2.Parts.Add(new Intent.Types.TrainingPhrase.Types.Part() { Text = "Qual o preço do curso de " }); frase2.Parts.Add(new Intent.Types.TrainingPhrase.Types.Part() { Text = "sistemas de informação", EntityType = "Cursos" }); intent.TrainingPhrases.Add(frase1); intent.TrainingPhrases.Add(frase2); var resposta = new Intent.Types.Message(); resposta.Text = new Intent.Types.Message.Types.Text(); resposta.Text.Text_.Add("1000.00"); intent.Messages.Add(resposta); var request = new Google.Cloud.Dialogflow.V2.CreateIntentRequest(); request.Intent = intent; request.ParentAsProjectAgentName = new ProjectAgentName(_agentName); c.CreateIntent(request); return(Ok("Entidade criada")); }
/// <summary>Snippet for GetIntent</summary> public void GetIntent1() { // Snippet: GetIntent(IntentName,CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) IntentName name = new IntentName("[PROJECT]", "[INTENT]"); // Make the request Intent response = intentsClient.GetIntent(name); // End snippet }
/// <summary>Snippet for GetIntent</summary> public void GetIntentResourceNames() { // Snippet: GetIntent(IntentName, CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) IntentName name = IntentName.FromProjectLocationAgentIntent("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"); // Make the request Intent response = intentsClient.GetIntent(name); // End snippet }
/// <summary>Snippet for GetIntent</summary> public void GetIntent() { // Snippet: GetIntent(string, CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/intents/[INTENT]"; // Make the request Intent response = intentsClient.GetIntent(name); // End snippet }
/// <summary>Snippet for CreateIntent</summary> public void CreateIntent() { // Snippet: CreateIntent(string, Intent, CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) string parent = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]"; Intent intent = new Intent(); // Make the request Intent response = intentsClient.CreateIntent(parent, intent); // End snippet }
/// <summary>Snippet for CreateIntent</summary> public void CreateIntentResourceNames() { // Snippet: CreateIntent(AgentName, Intent, CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) AgentName parent = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"); Intent intent = new Intent(); // Make the request Intent response = intentsClient.CreateIntent(parent, intent); // End snippet }
// [END dialogflow_delete_intent] public static int BatchDelete(string projectId, IEnumerable <string> intentIds) { var client = IntentsClient.Create(); var intents = intentIds.Select(id => new Intent() { Name = new IntentName(projectId, id).ToString() }); client.BatchDeleteIntents(new ProjectAgentName(projectId), intents); return(0); }
/// <summary>Snippet for UpdateIntent</summary> public void UpdateIntent() { // Snippet: UpdateIntent(Intent, FieldMask, CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) Intent intent = new Intent(); FieldMask updateMask = new FieldMask(); // Make the request Intent response = intentsClient.UpdateIntent(intent, updateMask); // End snippet }
/// <summary>Snippet for CreateIntent</summary> public void CreateIntent1() { // Snippet: CreateIntent(ProjectAgentName,Intent,CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) ProjectAgentName parent = new ProjectAgentName("[PROJECT]"); Intent intent = new Intent(); // Make the request Intent response = intentsClient.CreateIntent(parent, intent); // End snippet }
/// <summary>Snippet for UpdateIntent</summary> public void UpdateIntent1() { // Snippet: UpdateIntent(Intent,string,CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) Intent intent = new Intent(); string languageCode = ""; // Make the request Intent response = intentsClient.UpdateIntent(intent, languageCode); // End snippet }
// [START dialogflow_list_intents] public static int List(string projectId) { var client = IntentsClient.Create(); var intents = client.ListIntents(new ProjectAgentName(projectId)); foreach (var intent in intents) { Console.WriteLine($"Intent name: {intent.Name}"); Console.WriteLine($"Intent display name: {intent.DisplayName}"); Console.WriteLine($"Action: {intent.Action}"); Console.WriteLine($"Root follow-up intent: {intent.RootFollowupIntentName}"); Console.WriteLine($"Parent follow-up intent: {intent.ParentFollowupIntentName}"); Console.WriteLine($"Input contexts:"); foreach (var inputContextName in intent.InputContextNames) { Console.WriteLine($"Input context name: {inputContextName}"); } Console.WriteLine($"Output contexts:"); foreach (var outputContex in intent.OutputContexts) { Console.WriteLine($"Output context name: {outputContex.Name}"); } Console.WriteLine("Messages:"); foreach (var message in intent.Messages) { if (message.Text != null) { foreach (var text in message.Text.Text_) { Console.WriteLine($"Message text: {text}"); } } } Console.WriteLine($"Training Phrases ({intent.TrainingPhrases.Count})"); foreach (var trainingPhrase in intent.TrainingPhrases) { Console.WriteLine($"Phrase name: {trainingPhrase.Name}"); Console.WriteLine($"Phrase type: {trainingPhrase.Type}"); foreach (var phrasePart in trainingPhrase.Parts) { Console.WriteLine($"Phrase part: {phrasePart.Text}"); } } Console.WriteLine(); } return(0); }
/// <summary>Snippet for UpdateIntent</summary> public void UpdateIntent_RequestObject() { // Snippet: UpdateIntent(UpdateIntentRequest,CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) UpdateIntentRequest request = new UpdateIntentRequest { Intent = new Intent(), }; // Make the request Intent response = intentsClient.UpdateIntent(request); // End snippet }
/// <summary>Snippet for GetIntent</summary> public void GetIntent_RequestObject() { // Snippet: GetIntent(GetIntentRequest,CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) GetIntentRequest request = new GetIntentRequest { IntentName = new IntentName("[PROJECT]", "[INTENT]"), }; // Make the request Intent response = intentsClient.GetIntent(request); // End snippet }
/// <summary>Snippet for ListIntents</summary> public void ListIntentsRequestObject() { // Snippet: ListIntents(ListIntentsRequest, CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) ListIntentsRequest request = new ListIntentsRequest { ParentAsAgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"), LanguageCode = "", IntentView = IntentView.Unspecified, }; // Make the request PagedEnumerable <ListIntentsResponse, Intent> response = intentsClient.ListIntents(request); // Iterate over all response items, lazily performing RPCs as required foreach (Intent item in response) { // Do something with each item Console.WriteLine(item); } // Or iterate over pages (of server-defined size), performing one RPC per page foreach (ListIntentsResponse page in response.AsRawResponses()) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Intent item in page) { // Do something with each item Console.WriteLine(item); } } // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Intent> singlePage = response.ReadPage(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Intent item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
public List <FraseEntrenamientoModel> ObtenerFrasesEntrenamiento(string intentId) { var lista = new List <FraseEntrenamientoModel>(); try { var fileSavePath = System.Web.HttpContext.Current.Server.MapPath("~/Dialogflow.json/") + ConstantesWeb.DialogFlow.FilePrivateKeyIdJson; if ((System.IO.File.Exists(fileSavePath))) { var cred = GoogleCredential.FromFile(fileSavePath); var channel = new Channel(SessionsClient.DefaultEndpoint.Host, SessionsClient.DefaultEndpoint.Port, cred.ToChannelCredentials()); var client = IntentsClient.Create(channel); GetIntentRequest request = new GetIntentRequest { IntentName = new IntentName(ConstantesWeb.DialogFlow.ProjectId, intentId), IntentView = IntentView.Full }; var intent = client.GetIntent(request); //Frases de Entrenamiento var feId = 1; foreach (var trainingPhrase in intent.TrainingPhrases) { var fraseEntrenamiento = new FraseEntrenamientoModel(); fraseEntrenamiento.Id = feId++; fraseEntrenamiento.StrId = trainingPhrase.Name; fraseEntrenamiento.Tipo = trainingPhrase.Type + string.Empty; foreach (var phrasePart in trainingPhrase.Parts) { fraseEntrenamiento.Descripcion = fraseEntrenamiento.Descripcion + " " + phrasePart.Text; } lista.Add(fraseEntrenamiento); } } lista = lista.OrderBy(x => x.Descripcion).ToList(); } catch (Exception ex) { } return(lista); }
/// <summary>Snippet for DeleteIntent</summary> public void DeleteIntent_RequestObject() { // Snippet: DeleteIntent(DeleteIntentRequest,CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) DeleteIntentRequest request = new DeleteIntentRequest { IntentName = new IntentName("[PROJECT]", "[INTENT]"), }; // Make the request intentsClient.DeleteIntent(request); // End snippet }
/// <summary>Snippet for CreateIntent</summary> public void CreateIntent_RequestObject() { // Snippet: CreateIntent(CreateIntentRequest,CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) CreateIntentRequest request = new CreateIntentRequest { ParentAsProjectAgentName = new ProjectAgentName("[PROJECT]"), Intent = new Intent(), }; // Make the request Intent response = intentsClient.CreateIntent(request); // End snippet }
/// <summary>Snippet for GetIntent</summary> public void GetIntentRequestObject() { // Snippet: GetIntent(GetIntentRequest, CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) GetIntentRequest request = new GetIntentRequest { IntentName = IntentName.FromProjectLocationAgentIntent("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"), LanguageCode = "", }; // Make the request Intent response = intentsClient.GetIntent(request); // End snippet }
// [START dialogflow_create_intent] public static int Create(string projectId, string displayName, string messageText, string[] trainingPhrasesParts) { var client = IntentsClient.Create(); var text = new Intent.Types.Message.Types.Text(); text.Text_.Add(messageText); var message = new Intent.Types.Message() { Text = text }; var phraseParts = new List <Intent.Types.TrainingPhrase.Types.Part>(); foreach (var part in trainingPhrasesParts) { phraseParts.Add(new Intent.Types.TrainingPhrase.Types.Part() { Text = part }); } var trainingPhrase = new Intent.Types.TrainingPhrase(); trainingPhrase.Parts.AddRange(phraseParts); var intent = new Intent(); intent.DisplayName = displayName; intent.Messages.Add(message); intent.TrainingPhrases.Add(trainingPhrase); var newIntent = client.CreateIntent( parent: new ProjectAgentName(projectId), intent: intent ); Console.WriteLine($"Created Intent: {newIntent.Name}"); return(0); }
/// <summary>Snippet for ListIntents</summary> public void ListIntents2() { // Snippet: ListIntents(ProjectAgentName,string,string,int?,CallSettings) // Create client IntentsClient intentsClient = IntentsClient.Create(); // Initialize request argument(s) ProjectAgentName parent = new ProjectAgentName("[PROJECT]"); string languageCode = ""; // Make the request PagedEnumerable <ListIntentsResponse, Intent> response = intentsClient.ListIntents(parent: parent, languageCode: languageCode); // Iterate over all response items, lazily performing RPCs as required foreach (Intent item in response) { // Do something with each item Console.WriteLine(item); } // Or iterate over pages (of server-defined size), performing one RPC per page foreach (ListIntentsResponse page in response.AsRawResponses()) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Intent item in page) { Console.WriteLine(item); } } // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Intent> singlePage = response.ReadPage(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Intent item in singlePage) { Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
public async Task CreateAsync() { try { IEnumerable <Model.Intent> intentList = (await _intentService.GetIntentsAsync()).GetMappedResponse <IEnumerable <Model.Intent>, IEnumerable <Model.Intent> >(_mapper); if (intentList.Any()) { IntentsClient client = IntentsClient.Create(); foreach (Model.Intent intentResponse in intentList) { Intent intent = new Intent(); intent.DefaultResponsePlatforms.Add(Platform.ActionsOnGoogle); intent.DisplayName = intentResponse.DisplayName; intent.Messages.Add(AddIntentDefault(intentResponse.Text)); intent.Messages.Add(AddCustomPayload(intentResponse.AllocatedTime)); if (intentResponse.ParentIntentId != null) { intent.ParentFollowupIntentName = intentList.Where(x => x.Id == intentResponse.ParentIntentId).FirstOrDefault().DialogflowGeneratedName; } if (intentResponse.InputContext != null) { foreach (string inputContext in intentResponse.InputContext.Split(',')) { intent.InputContextNames.Add(AddIntentInputContext(inputContext)); } } if (intentResponse.OutputContext != null) { foreach (string outputContext in intentResponse.OutputContext.Split(',')) { intent.OutputContexts.Add(AddIntentOutputContext(outputContext)); } } if (intentResponse.IntentTrainingPhrase.Any()) { foreach (Model.IntentTrainingPhrase trainingPhrase in intentResponse.IntentTrainingPhrase) { intent.TrainingPhrases.Add(AddIntentTrainingPhrase(trainingPhrase)); } } if (intentResponse.IntentParameter.Any()) { foreach (Model.IntentParameter parameter in intentResponse.IntentParameter) { intent.Parameters.Add(AddIntentParameter(parameter)); } } if (intentResponse.IntentSuggestion.Any()) { intent.Messages.Add(AddIntentSuggestion(intentResponse.IntentSuggestion.Select(x => x.Title).ToList())); } intent = client.CreateIntent(parent: new ProjectAgentName("ht-interview-chatbot"), intent: intent); intentResponse.DialogflowGeneratedIntentId = intent.IntentName.IntentId; intentResponse.DialogflowGeneratedName = intent.Name; intentResponse.DialogflowGeneratedIntent = JsonConvert.SerializeObject(intent); await _intentService.UpdateIntentsAsync(_mapper.Map <Model.Intent>(intentResponse)); } } } catch (Exception ex) { string message = ex.Message; } }
public AlertModel UpdateIntent(Intencion intencion, List <FraseEntrenamientoModel> frases) { var intento = new IntentoModel(); var resultado = new AlertModel(); try { var fileSavePath = System.Web.HttpContext.Current.Server.MapPath("~/Dialogflow.json/") + ConstantesWeb.DialogFlow.FilePrivateKeyIdJson; if ((System.IO.File.Exists(fileSavePath))) { var cred = GoogleCredential.FromFile(fileSavePath); var channel = new Channel(SessionsClient.DefaultEndpoint.Host, SessionsClient.DefaultEndpoint.Port, cred.ToChannelCredentials()); var client = IntentsClient.Create(channel); GetIntentRequest getRequest = new GetIntentRequest { IntentName = new IntentName(ConstantesWeb.DialogFlow.ProjectId, intencion.IdDialogFlow), IntentView = IntentView.Full }; var intent = client.GetIntent(getRequest); //Actualizar Frases de Entrenamiento intent.TrainingPhrases.Clear(); foreach (var frase_ in frases) { var trainingPhrasesParts = new List <string>(); trainingPhrasesParts.Add(frase_.Descripcion); var phraseParts = new List <Intent.Types.TrainingPhrase.Types.Part>(); foreach (var part in trainingPhrasesParts) { phraseParts.Add(new Intent.Types.TrainingPhrase.Types.Part() { Text = part }); } var trainingPhrase = new Intent.Types.TrainingPhrase(); trainingPhrase.Parts.AddRange(phraseParts); intent.TrainingPhrases.Add(trainingPhrase); } //Actualizar Respuesta intent.Messages.Clear(); var text = new Intent.Types.Message.Types.Text(); text.Text_.Add(intencion.Respuesta); var message_ = new Intent.Types.Message() { Text = text }; intent.Messages.Add(message_); UpdateIntentRequest updRequest = new UpdateIntentRequest { Intent = intent }; Intent response = client.UpdateIntent(updRequest); resultado.DisplayName = response.DisplayName; resultado.Mensaje = "UPDATE-OK"; } } catch (Exception ex) { resultado.MessageError = "ERROR: " + ex.Message; resultado.Mensaje = "UPDATE-ERROR"; } return(resultado); }
public List <IntentoModel> ObtenerIntentos() { var intentos = new List <IntentoModel>(); try { List <GSAV.Entity.Objects.Intencion> intenciones = oIBLSolicitud.ObtenerIntenciones().OneResult; var fileSavePath = System.Web.HttpContext.Current.Server.MapPath("~/Dialogflow.json/") + ConstantesWeb.DialogFlow.FilePrivateKeyIdJson; if ((System.IO.File.Exists(fileSavePath))) { var cred = GoogleCredential.FromFile(fileSavePath); var channel = new Channel(SessionsClient.DefaultEndpoint.Host, SessionsClient.DefaultEndpoint.Port, cred.ToChannelCredentials()); var client = IntentsClient.Create(channel); ListIntentsRequest request = new ListIntentsRequest { ParentAsProjectAgentName = new ProjectAgentName(ConstantesWeb.DialogFlow.ProjectId), IntentView = IntentView.Full }; var intents = client.ListIntents(request); var intentoValido = false; foreach (var intent in intents) { var intento = new IntentoModel(); intento.Id = intent.IntentName.IntentId; intento.Nombre = intent.DisplayName; intentoValido = false; var row = intenciones.AsEnumerable().Where(q => q.IdDialogFlow.Equals(intento.Id)).FirstOrDefault(); if (row != null) { intento.IdIntencionConsulta = row.IdIntencionConsulta + string.Empty; intento.FechaCreacion = row.StrFechaCreacion; intento.IdIntencionPadre = row.IdPadreIntencion + string.Empty; intentoValido = true; } if (intentoValido) { //Frases de Entrenamiento var feId = 1; foreach (var trainingPhrase in intent.TrainingPhrases) { var fraseEntrenamiento = new FraseEntrenamientoModel(); fraseEntrenamiento.Id = feId++; fraseEntrenamiento.StrId = trainingPhrase.Name; foreach (var phrasePart in trainingPhrase.Parts) { fraseEntrenamiento.Descripcion = phrasePart.Text; } intento.FrasesEntrenamiento.Add(fraseEntrenamiento); } //Respuestas foreach (var message in intent.Messages) { if (message.Text != null) { var idRespuesta = 0; foreach (var text in message.Text.Text_) { idRespuesta++; var respuesta = new RespuestaIntentoModel(); respuesta.Id = idRespuesta + string.Empty; respuesta.Descripcion = text; intento.Respuestas.Add(respuesta); } } } intentos.Add(intento); } } intentos = intentos.OrderBy(x => x.Nombre).ToList(); } } catch (Exception ex) { } return(intentos); }
public AlertModel CreateIntent(Intencion intencion, List <FraseEntrenamientoModel> frases) { var intento = new IntentoModel(); var resultado = new AlertModel(); try { var fileSavePath = System.Web.HttpContext.Current.Server.MapPath("~/Dialogflow.json/") + ConstantesWeb.DialogFlow.FilePrivateKeyIdJson; if ((System.IO.File.Exists(fileSavePath))) { var cred = GoogleCredential.FromFile(fileSavePath); var channel = new Channel(SessionsClient.DefaultEndpoint.Host, SessionsClient.DefaultEndpoint.Port, cred.ToChannelCredentials()); var client = IntentsClient.Create(channel); var intent = new Intent(); intent.DisplayName = intencion.Nombre; //Actualizar Frases de Entrenamiento intent.TrainingPhrases.Clear(); foreach (var frase_ in frases) { var trainingPhrasesParts = new List <string>(); trainingPhrasesParts.Add(frase_.Descripcion); var phraseParts = new List <Intent.Types.TrainingPhrase.Types.Part>(); foreach (var part in trainingPhrasesParts) { phraseParts.Add(new Intent.Types.TrainingPhrase.Types.Part() { Text = part }); } var trainingPhrase = new Intent.Types.TrainingPhrase(); trainingPhrase.Parts.AddRange(phraseParts); intent.TrainingPhrases.Add(trainingPhrase); } //Actualizar Respuesta intent.Messages.Clear(); var text = new Intent.Types.Message.Types.Text(); text.Text_.Add(intencion.Respuesta); var message_ = new Intent.Types.Message() { Text = text }; intent.Messages.Add(message_); var newIntent = client.CreateIntent( parent: new ProjectAgentName(ConstantesWeb.DialogFlow.ProjectId), intent: intent ); resultado.Id = newIntent.IntentName.IntentId; resultado.DisplayName = newIntent.DisplayName; oIBLSolicitud.InsertarIntencionConsulta(newIntent.DisplayName, newIntent.IntentName.IntentId, ConvertidorUtil.GmtToPacific(DateTime.Now), intencion.IdIntencionPadre); resultado.Mensaje = "INSERT-OK"; } } catch (Exception ex) { resultado.MessageError = "ERROR: " + ex.Message; resultado.Mensaje = "INSERT-ERROR"; } return(resultado); }
public IntentoModel ObtenerIntentoDialogFlow(string nombreIntento) { var pIntento = new IntentoModel(); try { var fileSavePath = System.Web.HttpContext.Current.Server.MapPath("~/Dialogflow.json/") + ConstantesWeb.DialogFlow.FilePrivateKeyIdJson; if ((System.IO.File.Exists(fileSavePath))) { var cred = GoogleCredential.FromFile(fileSavePath); var channel = new Channel(SessionsClient.DefaultEndpoint.Host, SessionsClient.DefaultEndpoint.Port, cred.ToChannelCredentials()); var client = IntentsClient.Create(channel); ListIntentsRequest request = new ListIntentsRequest { ParentAsProjectAgentName = new ProjectAgentName(ConstantesWeb.DialogFlow.ProjectId), IntentView = IntentView.Full }; var intents = client.ListIntents(request); foreach (var intent in intents) { var intento = new IntentoModel(); intento.Id = intent.IntentName.IntentId; intento.Nombre = intent.DisplayName; if (intento.Nombre.ToUpper().Equals(nombreIntento.ToUpper())) { //Frases de Entrenamiento var feId = 1; foreach (var trainingPhrase in intent.TrainingPhrases) { var fraseEntrenamiento = new FraseEntrenamientoModel(); fraseEntrenamiento.Id = feId++; fraseEntrenamiento.StrId = trainingPhrase.Name; foreach (var phrasePart in trainingPhrase.Parts) { fraseEntrenamiento.Descripcion = phrasePart.Text; } intento.FrasesEntrenamiento.Add(fraseEntrenamiento); } //Respuestas foreach (var message in intent.Messages) { if (message.Text != null) { var idRespuesta = 0; foreach (var text in message.Text.Text_) { idRespuesta++; var respuesta = new RespuestaIntentoModel(); respuesta.Id = idRespuesta + string.Empty; respuesta.Descripcion = text; intento.Respuestas.Add(respuesta); } } } pIntento = intento; } } } } catch (Exception ex) { } return(pIntento); }