Merge branch 'master' of https://github.com/Oceania2018/BotSharp
This commit is contained in:
commit
a22a61f49f
|
|
@ -51,6 +51,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BotSharp.NLP" Version="0.2.4" />
|
||||
<PackageReference Include="Colorful.Console" Version="1.2.9" />
|
||||
<PackageReference Include="DotNetToolkit" Version="1.6.0" />
|
||||
<PackageReference Include="EntityFrameworkCore.BootKit" Version="1.9.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="2.1.1" />
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@ using DotNetToolkit;
|
|||
using EntityFrameworkCore.BootKit;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
|
@ -38,6 +40,7 @@ namespace BotSharp.Core.Engines
|
|||
{
|
||||
var preditor = new BotPredictor();
|
||||
var doc = preditor.Predict(agent, request).Result;
|
||||
|
||||
var parameters = new Dictionary<String, Object>();
|
||||
if(doc.Sentences[0].Entities == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,10 +8,12 @@ using Newtonsoft.Json.Linq;
|
|||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Console = Colorful.Console;
|
||||
|
||||
namespace BotSharp.Core.Engines
|
||||
{
|
||||
|
|
@ -69,6 +71,7 @@ namespace BotSharp.Core.Engines
|
|||
await pipe.Predict(agent, data, meta.Pipeline.FirstOrDefault(x => x.Name == pipelines[pipeIdx]));
|
||||
}
|
||||
|
||||
Console.WriteLine($"Prediction result:", Color.Green);
|
||||
Console.WriteLine(JsonConvert.SerializeObject(data, new JsonSerializerSettings
|
||||
{
|
||||
Formatting = Formatting.Indented,
|
||||
|
|
|
|||
|
|
@ -29,12 +29,15 @@ namespace BotSharp.Core.Engines.Classifiers
|
|||
|
||||
File.Delete(predictFileName);
|
||||
|
||||
doc.Sentences[0].Intent = new TextClassificationResult
|
||||
if (!String.IsNullOrEmpty(output))
|
||||
{
|
||||
Classifier = "FasttextClassifier",
|
||||
Label = output.Split(' ')[0].Split(new string[] { "__label__" }, StringSplitOptions.None)[1],
|
||||
Confidence = decimal.Parse(output.Split(' ')[1])
|
||||
};
|
||||
doc.Sentences[0].Intent = new TextClassificationResult
|
||||
{
|
||||
Classifier = "FasttextClassifier",
|
||||
Label = output.Split(' ')[0].Split(new string[] { "__label__" }, StringSplitOptions.None)[1],
|
||||
Confidence = decimal.Parse(output.Split(' ')[1])
|
||||
};
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,11 @@ using Microsoft.AspNetCore.Mvc;
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Console = Colorful.Console;
|
||||
|
||||
namespace BotSharp.RestApi.Rasa
|
||||
{
|
||||
|
|
@ -47,6 +49,7 @@ namespace BotSharp.RestApi.Rasa
|
|||
body = reader.ReadToEnd();
|
||||
}
|
||||
|
||||
Console.WriteLine($"Got message from {Request.Host}: {body}", Color.Green);
|
||||
if(request.Project ==null && !String.IsNullOrEmpty(body))
|
||||
{
|
||||
request = JsonConvert.DeserializeObject<RasaRequestModel>(body);
|
||||
|
|
|
|||
|
|
@ -53,6 +53,10 @@
|
|||
<None Remove="App_Data\BotSharp.db" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="App_Data\Corpus\CoNLL\conll2000_chunking_train.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" />
|
||||
</ItemGroup>
|
||||
|
|
@ -72,8 +76,4 @@
|
|||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ services:
|
|||
ports: ['0.0.0.0:3000:3000']
|
||||
networks: ['botsharp-network']
|
||||
environment:
|
||||
- rasanluendpoint=http://botsharp:5000
|
||||
- rasanluendpoint=http://rasa:5000
|
||||
- API_URL
|
||||
|
||||
botsharp:
|
||||
rasa:
|
||||
image: botsharpdocker/botsharp:latest
|
||||
ports: ['0.0.0.0:5000:5000']
|
||||
networks: ['botsharp-network']
|
||||
|
|
@ -32,4 +32,4 @@ services:
|
|||
command: redis-server --appendonly yes
|
||||
|
||||
|
||||
networks: {botsharp-network: {}}
|
||||
networks: {botsharp-network: {}}
|
||||
|
|
|
|||
Loading…
Reference in a new issue