BotSharp/Bot.Rasa.RestApi/EntityTypeController.cs
haiping008@gmail.com 33d42ae035 1. Added context in/ out, lifespan.
2. Import agent in Dialogflow format.
3. Lazy training per input contexts.
2018-03-21 16:07:43 -05:00

32 lines
888 B
C#

using Bot.Rasa.Agents;
using Bot.Rasa.Entities;
using EntityFrameworkCore.BootKit;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Text;
namespace Bot.Rasa.RestApi
{
public class EntityTypeController : EssentialController
{
[HttpPost]
public string CreateType([FromBody] Entity entityType)
{
var agent = dc.Table<Agent>().Find(entityType.AgentId);
dc.DbTran(() => agent.CreateEntityType(dc, entityType));
return entityType.Id;
}
[HttpDelete("{agentId}/{entityTypeId}")]
public IActionResult DeleteType([FromRoute] String agentId, [FromRoute] String entityTypeId)
{
var agent = dc.Table<Agent>().Find(agentId);
dc.DbTran(() => agent.DeleteEntityType(dc, entityTypeId));
return Ok();
}
}
}