Add entities and intents interface for Dialogflow mode.
This commit is contained in:
parent
9c99580317
commit
e20d7b48a3
|
|
@ -29,6 +29,11 @@
|
||||||
<param name="agentId"></param>
|
<param name="agentId"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:BotSharp.RestApi.Dialogflow.EntitiesController">
|
||||||
|
<summary>
|
||||||
|
The /entities endpoint is used to create, retrieve, update, and delete developer-defined entity objects.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:BotSharp.RestApi.Dialogflow.QueryController">
|
<member name="T:BotSharp.RestApi.Dialogflow.QueryController">
|
||||||
<summary>
|
<summary>
|
||||||
Dialogflow mode query controller
|
Dialogflow mode query controller
|
||||||
|
|
|
||||||
17
BotSharp.RestApi/Dialogflow/DialogflowAllEntityViewModel.cs
Normal file
17
BotSharp.RestApi/Dialogflow/DialogflowAllEntityViewModel.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BotSharp.RestApi.Dialogflow
|
||||||
|
{
|
||||||
|
public class DialogflowAllEntityViewModel
|
||||||
|
{
|
||||||
|
public int Count { get; set; }
|
||||||
|
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public string Preview { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
24
BotSharp.RestApi/Dialogflow/EntitiesController.cs
Normal file
24
BotSharp.RestApi/Dialogflow/EntitiesController.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BotSharp.RestApi.Dialogflow
|
||||||
|
{
|
||||||
|
#if DIALOGFLOW
|
||||||
|
/// <summary>
|
||||||
|
/// The /entities endpoint is used to create, retrieve, update, and delete developer-defined entity objects.
|
||||||
|
/// </summary>
|
||||||
|
[Authorize]
|
||||||
|
[Route("v1/[controller]")]
|
||||||
|
public class EntitiesController : ControllerBase
|
||||||
|
{
|
||||||
|
[HttpGet]
|
||||||
|
public IEnumerable<DialogflowAllEntityViewModel> All()
|
||||||
|
{
|
||||||
|
return new List<DialogflowAllEntityViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
55
BotSharp.RestApi/Dialogflow/IntentsController.cs
Normal file
55
BotSharp.RestApi/Dialogflow/IntentsController.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
using BotSharp.Core.Adapters.Dialogflow;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BotSharp.RestApi.Dialogflow
|
||||||
|
{
|
||||||
|
#if DIALOGFLOW
|
||||||
|
/// <summary>
|
||||||
|
/// The /intents endpoint is used to create, retrieve, update, and delete intent objects.
|
||||||
|
/// </summary>
|
||||||
|
[Authorize]
|
||||||
|
[Route("v1/[controller]")]
|
||||||
|
public class IntentsController : ControllerBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a list of all intents for the agent.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public IEnumerable<DialogflowIntent> GetIntents()
|
||||||
|
{
|
||||||
|
return new List<DialogflowIntent>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The POST request creates a new intent. When a new intent is created via the API, the agent is trained with the new data.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public string PostIntent([FromBody] DialogflowIntent intent)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the specified intent. {id} is the ID of the intent to retrieve.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("{id}")]
|
||||||
|
public DialogflowIntent GetIntent()
|
||||||
|
{
|
||||||
|
return new DialogflowIntent();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPut("{id}")]
|
||||||
|
public bool PutIntent([FromBody] DialogflowIntent intent)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
BIN
docs/static/logos/WechatQRCode.png
vendored
Normal file
BIN
docs/static/logos/WechatQRCode.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 120 KiB |
Loading…
Reference in a new issue