diff --git a/BotSharp.RestApi/Rasa/ParseController.cs b/BotSharp.RestApi/Rasa/ParseController.cs
index 3d9751c6..d556a61d 100644
--- a/BotSharp.RestApi/Rasa/ParseController.cs
+++ b/BotSharp.RestApi/Rasa/ParseController.cs
@@ -7,6 +7,7 @@ using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using System.Text;
namespace BotSharp.RestApi.Rasa
@@ -35,7 +36,7 @@ namespace BotSharp.RestApi.Rasa
///
///
[HttpPost, HttpGet]
- public ActionResult Parse()
+ public ActionResult> Parse()
{
var config = new AIConfiguration("", SupportedLanguage.English);
config.SessionId = "rasa nlu";
@@ -64,19 +65,25 @@ namespace BotSharp.RestApi.Rasa
Query = new String[] { request.Text }
});
- return new RasaResponse
+ var rasaResponse = new RasaResponse
{
Intent = new RasaResponseIntent
{
Name = aIResponse.Result.Metadata.IntentName,
Confidence = aIResponse.Result.Score
},
- Entities = new List
+ Entities = aIResponse.Result.Parameters.Select(x => new RasaResponseEntity
{
-
- },
- Text = ""
+ Entity = x.Key,
+ Value = x.Value.ToString()
+ }).ToList(),
+ Text = request.Text,
+ Model = request.Model,
+ Project = request.Project,
+ IntentRanking = new List { }
};
+
+ return new List { rasaResponse };
}
}
#endif
diff --git a/BotSharp.RestApi/Rasa/TrainController.cs b/BotSharp.RestApi/Rasa/TrainController.cs
index 4fd5894e..861ea9db 100644
--- a/BotSharp.RestApi/Rasa/TrainController.cs
+++ b/BotSharp.RestApi/Rasa/TrainController.cs
@@ -36,11 +36,11 @@ namespace BotSharp.RestApi.Rasa
///
/// Using the HTTP server, you must specify the project you want to train a new model for to be able to use it during parse requests later on : /train?project=my_project.
///
- /// Model name
+ /// Model name
///
///
[HttpPost]
- public async Task> Train([FromQuery] string agent, [FromQuery] string project)
+ public async Task> Train([FromQuery] string model, [FromQuery] string project)
{
string body = "";
using (var reader = new StreamReader(Request.Body))
@@ -49,7 +49,7 @@ namespace BotSharp.RestApi.Rasa
}
var rasa_nlu_data = JsonConvert.DeserializeObject(body);
- rasa_nlu_data.Model = agent;
+ rasa_nlu_data.Model = model;
var trainResult = await Train(rasa_nlu_data, project);
return trainResult;