public async Task <AgentModel> GetAgentIntents([FromRoute] string agentName) { var agent = await builder.GetAgentByName(agentName); if (agent.Intents == null) { agent.Intents = new List <Models.IntentModel>(); } return(agent); }
public async Task <EntityModel> PostEntity() { EntityModel entity = null; using (var reader = new StreamReader(Request.Body)) { string body = reader.ReadToEnd(); entity = JsonConvert.DeserializeObject <EntityModel>(body); } var agent = await builder.GetAgentByName(entity.Agent); entity.Id = Guid.NewGuid().ToString(); agent.Entities.Add(entity); await builder.SaveAgent(agent); return(entity); }
public async Task <List <ExpressionModel> > GetExpressionsByIntent([FromRoute] string agentName, [FromRoute] string intentName) { var agent = await builder.GetAgentByName(agentName); return(agent.Intents.First(x => x.Name == intentName).Expressions); }