diff --git a/BotSharp.Core/BotSharp.Core.csproj b/BotSharp.Core/BotSharp.Core.csproj index 4b37fa8a..63225fc6 100644 --- a/BotSharp.Core/BotSharp.Core.csproj +++ b/BotSharp.Core/BotSharp.Core.csproj @@ -81,7 +81,6 @@ If you feel that this project is helpful to you, please Star on the project, we - diff --git a/BotSharp.Core/Engines/BotTrainer.cs b/BotSharp.Core/Engines/BotTrainer.cs index f8c76cb2..35c00a95 100644 --- a/BotSharp.Core/Engines/BotTrainer.cs +++ b/BotSharp.Core/Engines/BotTrainer.cs @@ -5,11 +5,11 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using BotSharp.Core.Abstractions; +using BotSharp.Platform.Abstraction; using BotSharp.Platform.Models; using BotSharp.Platform.Models.MachineLearning; using DotNetToolkit; using EntityFrameworkCore.BootKit; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -22,9 +22,11 @@ namespace BotSharp.Core.Engines private readonly Database dc; private readonly string agentId; + private readonly IPlatformSettings settings; - public BotTrainer() + public BotTrainer(IPlatformSettings setting) { + this.settings = setting; } public BotTrainer(string agentId, Database dc) @@ -41,7 +43,7 @@ namespace BotSharp.Core.Engines var config = (IConfiguration)AppDomain.CurrentDomain.GetData("Configuration"); var assemblies = (string[])AppDomain.CurrentDomain.GetData("Assemblies"); var platform = config.GetSection($"platformModuleName").Value; - var engine = config.GetSection($"{platform}:botEngine").Value; + var engine = this.settings.BotEngine; string providerName = config.GetSection($"{engine}:Provider").Value; var provider = TypeHelper.GetInstance(providerName, assemblies) as INlpProvider; provider.Configuration = config.GetSection(engine); diff --git a/BotSharp.Core/PlatformBuilderBase.cs b/BotSharp.Core/PlatformBuilderBase.cs index a18443ee..1d991f6a 100644 --- a/BotSharp.Core/PlatformBuilderBase.cs +++ b/BotSharp.Core/PlatformBuilderBase.cs @@ -19,10 +19,12 @@ namespace BotSharp.Core public IAgentStorage Storage { get; set; } private readonly IAgentStorageFactory agentStorageFactory; + private readonly IPlatformSettings settings; - public PlatformBuilderBase(IAgentStorageFactory agentStorageFactory) + public PlatformBuilderBase(IAgentStorageFactory agentStorageFactory, IPlatformSettings settings) { this.agentStorageFactory = agentStorageFactory; + this.settings = settings; } public async Task> GetAllAgents() @@ -89,7 +91,7 @@ namespace BotSharp.Core options.Model = "model_" + DateTime.UtcNow.ToString("yyyyMMdd"); } - var trainer = new BotTrainer(); + var trainer = new BotTrainer(settings); agent.Corpus = corpus; var info = await trainer.Train(agent, options); diff --git a/BotSharp.WebHost/Settings/DialogflowAi.json b/BotSharp.WebHost/Settings/DialogflowAi.json index 72181242..aa8cba6d 100644 --- a/BotSharp.WebHost/Settings/DialogflowAi.json +++ b/BotSharp.WebHost/Settings/DialogflowAi.json @@ -1,6 +1,7 @@ { // if you want to override platform setting, please set corresponding value, otherwise you don't need this section. "dialogflowAi": { - "botEngine": "BotSharpNLU" + "botEngine": "BotSharpNLU", + "agentStorage": "AgentStorageInRedis" } } diff --git a/BotSharp.WebHost/wwwroot/images/BotSharp.min.png b/BotSharp.WebHost/wwwroot/images/BotSharp.min.png index 8572d1f8..ea4a355d 100644 Binary files a/BotSharp.WebHost/wwwroot/images/BotSharp.min.png and b/BotSharp.WebHost/wwwroot/images/BotSharp.min.png differ diff --git a/BotSharp.WebHost/wwwroot/images/BotSharp.png b/BotSharp.WebHost/wwwroot/images/BotSharp.png index defe10f9..1ff4ab5d 100644 Binary files a/BotSharp.WebHost/wwwroot/images/BotSharp.png and b/BotSharp.WebHost/wwwroot/images/BotSharp.png differ diff --git a/BotSharp.WebHost/wwwroot/images/BotSharp.psd b/BotSharp.WebHost/wwwroot/images/BotSharp.psd index db98df7b..431b5974 100644 Binary files a/BotSharp.WebHost/wwwroot/images/BotSharp.psd and b/BotSharp.WebHost/wwwroot/images/BotSharp.psd differ diff --git a/BotSharp.sln b/BotSharp.sln index ed4e217b..417f92e4 100644 --- a/BotSharp.sln +++ b/BotSharp.sln @@ -26,6 +26,8 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 + DIALOGFLOW|Any CPU = DIALOGFLOW|Any CPU + DIALOGFLOW|x64 = DIALOGFLOW|x64 Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 EndGlobalSection @@ -34,6 +36,10 @@ Global {95780673-2A1A-4953-962F-C46CBFDD07FF}.Debug|Any CPU.Build.0 = Debug|Any CPU {95780673-2A1A-4953-962F-C46CBFDD07FF}.Debug|x64.ActiveCfg = Debug|x64 {95780673-2A1A-4953-962F-C46CBFDD07FF}.Debug|x64.Build.0 = Debug|x64 + {95780673-2A1A-4953-962F-C46CBFDD07FF}.DIALOGFLOW|Any CPU.ActiveCfg = DIALOGFLOW|Any CPU + {95780673-2A1A-4953-962F-C46CBFDD07FF}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU + {95780673-2A1A-4953-962F-C46CBFDD07FF}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|x64 + {95780673-2A1A-4953-962F-C46CBFDD07FF}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|x64 {95780673-2A1A-4953-962F-C46CBFDD07FF}.Release|Any CPU.ActiveCfg = Release|Any CPU {95780673-2A1A-4953-962F-C46CBFDD07FF}.Release|Any CPU.Build.0 = Release|Any CPU {95780673-2A1A-4953-962F-C46CBFDD07FF}.Release|x64.ActiveCfg = Release|x64 @@ -42,6 +48,10 @@ Global {03DCA427-327A-4FC9-9A2F-57D17F16708C}.Debug|Any CPU.Build.0 = Debug|Any CPU {03DCA427-327A-4FC9-9A2F-57D17F16708C}.Debug|x64.ActiveCfg = Debug|x64 {03DCA427-327A-4FC9-9A2F-57D17F16708C}.Debug|x64.Build.0 = Debug|x64 + {03DCA427-327A-4FC9-9A2F-57D17F16708C}.DIALOGFLOW|Any CPU.ActiveCfg = Debug|Any CPU + {03DCA427-327A-4FC9-9A2F-57D17F16708C}.DIALOGFLOW|Any CPU.Build.0 = Debug|Any CPU + {03DCA427-327A-4FC9-9A2F-57D17F16708C}.DIALOGFLOW|x64.ActiveCfg = Debug|x64 + {03DCA427-327A-4FC9-9A2F-57D17F16708C}.DIALOGFLOW|x64.Build.0 = Debug|x64 {03DCA427-327A-4FC9-9A2F-57D17F16708C}.Release|Any CPU.ActiveCfg = Release|Any CPU {03DCA427-327A-4FC9-9A2F-57D17F16708C}.Release|Any CPU.Build.0 = Release|Any CPU {03DCA427-327A-4FC9-9A2F-57D17F16708C}.Release|x64.ActiveCfg = Release|x64 @@ -50,6 +60,10 @@ Global {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.Debug|Any CPU.Build.0 = Debug|Any CPU {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.Debug|x64.ActiveCfg = Debug|x64 {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.Debug|x64.Build.0 = Debug|x64 + {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.DIALOGFLOW|Any CPU.ActiveCfg = DIALOGFLOW|Any CPU + {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU + {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|x64 + {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|x64 {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.Release|Any CPU.ActiveCfg = Release|Any CPU {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.Release|Any CPU.Build.0 = Release|Any CPU {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.Release|x64.ActiveCfg = Release|x64 @@ -58,6 +72,10 @@ Global {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.Debug|Any CPU.Build.0 = Debug|Any CPU {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.Debug|x64.ActiveCfg = Debug|x64 {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.Debug|x64.Build.0 = Debug|x64 + {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.DIALOGFLOW|Any CPU.ActiveCfg = DIALOGFLOW|Any CPU + {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU + {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|x64 + {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|x64 {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.Release|Any CPU.ActiveCfg = Release|Any CPU {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.Release|Any CPU.Build.0 = Release|Any CPU {8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.Release|x64.ActiveCfg = Release|x64 @@ -66,6 +84,10 @@ Global {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.Debug|Any CPU.Build.0 = Debug|Any CPU {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.Debug|x64.ActiveCfg = Debug|x64 {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.Debug|x64.Build.0 = Debug|x64 + {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.DIALOGFLOW|Any CPU.ActiveCfg = DIALOGFLOW|Any CPU + {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU + {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|x64 + {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|x64 {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.Release|Any CPU.ActiveCfg = Release|Any CPU {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.Release|Any CPU.Build.0 = Release|Any CPU {30F80E7D-951A-4E8F-9C3C-2C866528EABD}.Release|x64.ActiveCfg = Release|x64 @@ -74,6 +96,10 @@ Global {62F08F9F-16C2-4754-90B0-B604DC18AE23}.Debug|Any CPU.Build.0 = Debug|Any CPU {62F08F9F-16C2-4754-90B0-B604DC18AE23}.Debug|x64.ActiveCfg = Debug|Any CPU {62F08F9F-16C2-4754-90B0-B604DC18AE23}.Debug|x64.Build.0 = Debug|Any CPU + {62F08F9F-16C2-4754-90B0-B604DC18AE23}.DIALOGFLOW|Any CPU.ActiveCfg = Debug|Any CPU + {62F08F9F-16C2-4754-90B0-B604DC18AE23}.DIALOGFLOW|Any CPU.Build.0 = Debug|Any CPU + {62F08F9F-16C2-4754-90B0-B604DC18AE23}.DIALOGFLOW|x64.ActiveCfg = Debug|Any CPU + {62F08F9F-16C2-4754-90B0-B604DC18AE23}.DIALOGFLOW|x64.Build.0 = Debug|Any CPU {62F08F9F-16C2-4754-90B0-B604DC18AE23}.Release|Any CPU.ActiveCfg = Release|Any CPU {62F08F9F-16C2-4754-90B0-B604DC18AE23}.Release|Any CPU.Build.0 = Release|Any CPU {62F08F9F-16C2-4754-90B0-B604DC18AE23}.Release|x64.ActiveCfg = Release|Any CPU @@ -82,6 +108,10 @@ Global {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Debug|Any CPU.Build.0 = Debug|Any CPU {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Debug|x64.ActiveCfg = Debug|Any CPU {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Debug|x64.Build.0 = Debug|Any CPU + {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.DIALOGFLOW|Any CPU.ActiveCfg = Debug|Any CPU + {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.DIALOGFLOW|Any CPU.Build.0 = Debug|Any CPU + {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.DIALOGFLOW|x64.ActiveCfg = Debug|Any CPU + {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.DIALOGFLOW|x64.Build.0 = Debug|Any CPU {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Release|Any CPU.ActiveCfg = Release|Any CPU {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Release|Any CPU.Build.0 = Release|Any CPU {C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Release|x64.ActiveCfg = Release|Any CPU