diff --git a/BotSharp.Core/BotSharp.Core.csproj b/BotSharp.Core/BotSharp.Core.csproj index 12d7e765..a02efdf4 100644 --- a/BotSharp.Core/BotSharp.Core.csproj +++ b/BotSharp.Core/BotSharp.Core.csproj @@ -72,9 +72,9 @@ If you feel that this project is helpful to you, please Star on the project, we - + - + @@ -82,7 +82,7 @@ If you feel that this project is helpful to you, please Star on the project, we - + diff --git a/BotSharp.Core/Engines/BotSharp/BotSharpIntentClassifier.cs b/BotSharp.Core/Engines/BotSharp/BotSharpIntentClassifier.cs index 86fca2e4..39f6c266 100644 --- a/BotSharp.Core/Engines/BotSharp/BotSharpIntentClassifier.cs +++ b/BotSharp.Core/Engines/BotSharp/BotSharpIntentClassifier.cs @@ -9,6 +9,7 @@ using System; using System.IO; using System.Linq; using System.Threading.Tasks; +using Newtonsoft.Json; namespace BotSharp.Core.Engines.BotSharp { diff --git a/BotSharp.Core/Engines/BotTrainer.cs b/BotSharp.Core/Engines/BotTrainer.cs index abc0b5de..9124c1f2 100644 --- a/BotSharp.Core/Engines/BotTrainer.cs +++ b/BotSharp.Core/Engines/BotTrainer.cs @@ -95,6 +95,8 @@ namespace BotSharp.Core.Engines for (int pipeIdx = 0; pipeIdx < pipelines.Count; pipeIdx++) { + Console.WriteLine(""); + Console.WriteLine($"Executing {pipeModel.Name}"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); @@ -109,7 +111,8 @@ namespace BotSharp.Core.Engines Time = DateTime.UtcNow }; meta.Pipeline.Add(pipeModel); - + + Console.WriteLine(JsonConvert.SerializeObject(pipeModel, Formatting.Indented)); await pipe.Train(agent, data, pipeModel); stopwatch.Stop(); diff --git a/BotSharp.Core/Engines/OwnThink/OwnThinkApi.cs b/BotSharp.Core/Engines/OwnThink/OwnThinkApi.cs new file mode 100644 index 00000000..d62225f7 --- /dev/null +++ b/BotSharp.Core/Engines/OwnThink/OwnThinkApi.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BotSharp.Core.Engines.OwnThink +{ + public class OwnThinkApi + { + + } +} diff --git a/BotSharp.Core/Engines/OwnThink/OwnThinkChatResponse.cs b/BotSharp.Core/Engines/OwnThink/OwnThinkChatResponse.cs new file mode 100644 index 00000000..a7c4b2a3 --- /dev/null +++ b/BotSharp.Core/Engines/OwnThink/OwnThinkChatResponse.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BotSharp.Core.Engines.OwnThink +{ + public class OwnThinkChatResponse + { + public OwnThinkChatResponseData Data { get; set; } + + public string Message { get; set; } + } + + public class OwnThinkChatResponseData + { + public OwnThinkChatResponseDataInfo Info { get; set; } + + public int Type { get; set; } + } + + public class OwnThinkChatResponseDataInfo + { + public string Text { get; set; } + } +} diff --git a/BotSharp.Core/PlatformBuilderBase.cs b/BotSharp.Core/PlatformBuilderBase.cs index 5fdbb221..f79fa366 100644 --- a/BotSharp.Core/PlatformBuilderBase.cs +++ b/BotSharp.Core/PlatformBuilderBase.cs @@ -1,4 +1,5 @@ using BotSharp.Core.Engines; +using BotSharp.Core.Engines.OwnThink; using BotSharp.Platform.Abstraction; using BotSharp.Platform.Models; using BotSharp.Platform.Models.AiRequest; @@ -219,8 +220,9 @@ namespace BotSharp.Core { var data = new { - token = "openbot", - info = request.Text + appid = "openbot", + userid = "yener", + spoken = request.Text }; using (var client = new HttpClient()) @@ -229,12 +231,12 @@ namespace BotSharp.Core "https://api.ownthink.com/bot", new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json")); var content = await response.Content.ReadAsStringAsync(); - var result = JsonConvert.DeserializeObject(content); + var result = JsonConvert.DeserializeObject(content); return new TextClassificationResult { Classifier = "ownthink", - Text = result["text"].ToString() + Text = result.Data.Info.Text }; } } diff --git a/BotSharp.WebHost/App_Data/AgentArchive/BotSharp_zh-cn.zip b/BotSharp.WebHost/App_Data/AgentArchive/BotSharp_zh-cn.zip index f92eb764..664da4bf 100644 Binary files a/BotSharp.WebHost/App_Data/AgentArchive/BotSharp_zh-cn.zip and b/BotSharp.WebHost/App_Data/AgentArchive/BotSharp_zh-cn.zip differ diff --git a/BotSharp.WebHost/BotSharp.WebHost.csproj b/BotSharp.WebHost/BotSharp.WebHost.csproj index 2ca1d52b..e6e94411 100644 --- a/BotSharp.WebHost/BotSharp.WebHost.csproj +++ b/BotSharp.WebHost/BotSharp.WebHost.csproj @@ -33,6 +33,7 @@ + @@ -40,6 +41,7 @@ + @@ -47,6 +49,7 @@ + @@ -54,6 +57,7 @@ + diff --git a/BotSharp.WebHost/Properties/PublishProfiles/Docker.pubxml b/BotSharp.WebHost/Properties/PublishProfiles/Docker.pubxml index 65e0607a..dd4158ff 100644 --- a/BotSharp.WebHost/Properties/PublishProfiles/Docker.pubxml +++ b/BotSharp.WebHost/Properties/PublishProfiles/Docker.pubxml @@ -15,7 +15,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt 03dca427-327a-4fc9-9a2f-57d17f16708c publish\ True - netcoreapp2.1 + netcoreapp2.2 false <_IsPortable>true diff --git a/BotSharp.WebHost/Properties/PublishProfiles/Docker.pubxml.user b/BotSharp.WebHost/Properties/PublishProfiles/Docker.pubxml.user index 1c02563d..50bc5efc 100644 --- a/BotSharp.WebHost/Properties/PublishProfiles/Docker.pubxml.user +++ b/BotSharp.WebHost/Properties/PublishProfiles/Docker.pubxml.user @@ -6,6 +6,6 @@ by editing this MSBuild file. In order to learn more about this please visit htt - <_PublishTargetUrl>C:\Users\haipi\Documents\Projects\BotSharp\BotSharp.WebHost\publish\ + <_PublishTargetUrl>D:\Projects\BotSharp\BotSharp.WebHost\publish\ \ No newline at end of file diff --git a/BotSharp.WebHost/Settings/DialogflowAi.json b/BotSharp.WebHost/Settings/DialogflowAi.json index 9409b827..ede46f12 100644 --- a/BotSharp.WebHost/Settings/DialogflowAi.json +++ b/BotSharp.WebHost/Settings/DialogflowAi.json @@ -1,5 +1,6 @@ { - // if you want to override platform setting, please set corresponding value, otherwise you don't need this section. + // if you want to override platform setting, please set corresponding value, + // otherwise you don't need this section. "dialogflowAi": { "botEngine": "BotSharpNLU", "agentStorage": "AgentStorageInFile",