Merge pull request #8 from Oceania2018/master

merge newest
This commit is contained in:
geffzhang 2018-10-14 22:26:21 +08:00 committed by GitHub
commit ec78898fe2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 283 additions and 377 deletions

View file

@ -0,0 +1,30 @@
using BotSharp.Core;
using BotSharp.Platform.Abstraction;
using BotSharp.Platform.Models;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace BotSharp.Core.AgentStorage
{
public class AgentStorageFactory<TAgent> : IAgentStorageFactory<TAgent> where TAgent : AgentBase
{
private readonly Func<string, IAgentStorage<TAgent>> func;
private readonly IPlatformSettings platformSetting;
public AgentStorageFactory(IPlatformSettings setting, Func<string, IAgentStorage<TAgent>> serviceAccessor)
{
this.func = serviceAccessor;
this.platformSetting = setting;
}
public async Task<IAgentStorage<TAgent>> Get()
{
IAgentStorage<TAgent> storage = null;
string storageName = this.platformSetting.AgentStorage;
storage = func(storageName);
return storage as IAgentStorage<TAgent>;
}
}
}

View file

@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BotSharp.Core
namespace BotSharp.Core.AgentStorage
{
/// <summary>
/// Save agent instance into memory.

View file

@ -9,7 +9,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BotSharp.Core
namespace BotSharp.Core.AgentStorage
{
public class AgentStorageInRedis<TAgent> : IAgentStorage<TAgent>
where TAgent : AgentBase

View file

@ -0,0 +1,43 @@
using BotSharp.Platform.Abstraction;
using BotSharp.Platform.Models;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.Core.AgentStorage
{
public class AgentStorageServiceRegister
{
public static void Register<TAgent>(IServiceCollection services)
where TAgent : AgentBase
{
services.AddSingleton<IAgentStorageFactory<TAgent>, AgentStorageFactory<TAgent>>();
services.AddSingleton<AgentStorageInMemory<TAgent>>();
services.AddSingleton<AgentStorageInRedis<TAgent>>();
services.AddSingleton(factory =>
{
Func<string, IAgentStorage<TAgent>> accesor = key =>
{
if (key.Equals("AgentStorageInRedis"))
{
return factory.GetService<AgentStorageInRedis<TAgent>>();
}
else if (key.Equals("AgentStorageInMemory"))
{
return factory.GetService<AgentStorageInMemory<TAgent>>();
}
else
{
throw new ArgumentException($"Not Support key : {key}");
}
};
return accesor;
});
}
}
}

View file

@ -21,13 +21,13 @@ If you feel that this project is helpful to you, please Star on the project, we
<RepositoryType>MIT</RepositoryType>
<RepositoryUrl>https://github.com/Oceania2018/BotSharp</RepositoryUrl>
<PackageTags>NLU, Chatbot, Bot, AI Bot, Artificial Intelligence, RPA</PackageTags>
<Version>1.5.0</Version>
<Version>1.6.0</Version>
<PackageReleaseNotes>Monthly Update.
Integrated with Articulate UI.
If you feel that this project is helpful to you, please Star on the project, we will be very grateful.</PackageReleaseNotes>
<Copyright>Since 2018 Haiping Chen</Copyright>
<PackageProjectUrl>https://github.com/Oceania2018/BotSharp</PackageProjectUrl>
<AssemblyVersion>1.5.0.0</AssemblyVersion>
<AssemblyVersion>1.6.0.0</AssemblyVersion>
<PackageIconUrl>https://raw.githubusercontent.com/Oceania2018/BotSharp/master/BotSharp.WebHost/wwwroot/images/BotSharp.png</PackageIconUrl>
<PackageLicenseUrl>https://github.com/Oceania2018/BotSharp/blob/master/LICENSE</PackageLicenseUrl>
</PropertyGroup>
@ -81,7 +81,6 @@ If you feel that this project is helpful to you, please Star on the project, we
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="RestSharp" Version="106.4.2" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
</ItemGroup>

View file

@ -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)
@ -40,8 +42,8 @@ namespace BotSharp.Core.Engines
// Get NLP Provider
var config = (IConfiguration)AppDomain.CurrentDomain.GetData("Configuration");
var assemblies = (string[])AppDomain.CurrentDomain.GetData("Assemblies");
var platform = config.GetSection($"platform").Value;
var engine = config.GetSection($"{platform}:botEngine").Value;
var platform = config.GetSection($"platformModuleName").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);

View file

@ -1,11 +0,0 @@
using BotSharp.Platform.Abstraction;
using BotSharp.Platform.Models;
using System.Threading.Tasks;
namespace BotSharp.Core
{
public interface IAgentStorageFactory
{
Task<IAgentStorage<TAgent>> Get<TAgent>() where TAgent : AgentBase;
}
}

View file

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
@ -27,6 +28,6 @@ namespace BotSharp.Core.Modules
/// <param name="app">
/// Instance of <see cref="IApplicationBuilder"/>.
/// </param>
void Configure(IApplicationBuilder app);
void Configure(IApplicationBuilder app, IHostingEnvironment env);
}
}

View file

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
@ -77,11 +78,11 @@ namespace BotSharp.Core.Modules
/// <param name="app">
/// Instance of <see cref="IApplicationBuilder"/>.
/// </param>
public void Configure(IApplicationBuilder app)
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
foreach (IModule module in this._modules)
{
module.Configure(app);
module.Configure(app, env);
}
}
}

View file

@ -18,31 +18,32 @@ namespace Microsoft.Extensions.DependencyInjection
{
ModulesOptions options = configuration.Get<ModulesOptions>();
var platform = configuration.GetValue<string>("platformModuleName");
var module = options.Modules.Find(x => x.Name == platform);
var engine = configuration.GetValue<string>($"{platform}:BotEngine");
Formatter[] settings = new Formatter[]
{
new Formatter(platform, Color.Yellow),
new Formatter(module.Name, Color.Yellow),
new Formatter(engine, Color.Yellow),
};
// load platform emulator dynamically
Console.WriteLine();
var platformDllPath = Path.Combine(options.ModuleBasePath, module.Path, $"{module.Type}.dll");
if (File.Exists(platformDllPath))
{
Assembly library = AssemblyLoadContext.Default.LoadFromAssemblyPath(platformDllPath);
action(library);
Console.WriteLineFormatted("Loaded {0} platform emulator from {1} assembly which is using {2} engine.", Color.White, settings);
}
else
{
Console.WriteLine($"Can't load {module.Type} assembly.");
}
options.Modules.ForEach(module => {
var dllPath = Path.Combine(options.ModuleBasePath, module.Path, $"{module.Type}.dll");
if (File.Exists(dllPath))
{
Assembly library = AssemblyLoadContext.Default.LoadFromAssemblyPath(dllPath);
action(library);
Formatter[] settings = new Formatter[]
{
new Formatter(module.Name, Color.Yellow),
new Formatter(module.Type, Color.Yellow),
new Formatter(dllPath, Color.Yellow)
};
Console.WriteLineFormatted("Loaded {0} module, type: {1}, path: {2}", Color.White, settings);
}
else
{
Console.WriteLine($"Can't load {module.Type} assembly from {dllPath}.");
}
});
Console.WriteLine();
}
}

View file

@ -1,17 +0,0 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.Core
{
public class NLUSetting
{
public string BotEngine { get; set; }
public string AgentStorage { get; set; }
}
}

View file

@ -18,11 +18,13 @@ namespace BotSharp.Core
{
public IAgentStorage<TAgent> Storage { get; set; }
private readonly IAgentStorageFactory agentStorageFactory;
private readonly IAgentStorageFactory<TAgent> agentStorageFactory;
private readonly IPlatformSettings settings;
public PlatformBuilderBase(IAgentStorageFactory agentStorageFactory)
public PlatformBuilderBase(IAgentStorageFactory<TAgent> agentStorageFactory, IPlatformSettings settings)
{
this.agentStorageFactory = agentStorageFactory;
this.settings = settings;
}
public async Task<List<TAgent>> 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);
@ -111,7 +113,7 @@ namespace BotSharp.Core
{
if (Storage == null)
{
Storage = await agentStorageFactory.Get<TAgent>();
Storage = await agentStorageFactory.Get();
}
return Storage;
}

View file

@ -0,0 +1,32 @@
using BotSharp.Platform.Abstraction;
using Colorful;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using Console = Colorful.Console;
namespace BotSharp.Core
{
public class PlatformConfigServiceRegister
{
public static void Register<ISettings>(string section, IServiceCollection services, IConfiguration config)
where ISettings : IPlatformSettings, new()
{
var setting = new ISettings();
config.GetSection(section).Bind(setting);
services.AddSingleton<IPlatformSettings>(setting);
Formatter[] settings = new Formatter[]
{
new Formatter(setting.BotEngine, Color.Yellow),
new Formatter(setting.AgentStorage, Color.Yellow)
};
Console.WriteLineFormatted("NLU engine: {0}, Agent Storage: {1}.", Color.White, settings);
Console.WriteLine();
}
}
}

View file

@ -0,0 +1,26 @@
using BotSharp.Platform.Abstraction;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.Core
{
public class PlatformSettingsBase : IPlatformSettings
{
/// <summary>
/// Set default settings
/// </summary>
public PlatformSettingsBase()
{
BotEngine = "BotSharpNLU";
AgentStorage = "AgentStorageInMemory";
}
public string BotEngine { get; set; }
public string AgentStorage { get; set; }
}
}

View file

@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<Platforms>AnyCPU;x64</Platforms>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.3.0</Version>
<Version>0.4.0</Version>
<Description>Botsharp.NLP is a set of tools for building C# programs to work with human language data. It can be used in common tasks like POS, NER and text classification in the NLP or NLU field.
BotSharp.NLP has implemented below machine learning algorithms:

View file

@ -2,6 +2,8 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.1.0</Version>
</PropertyGroup>
<ItemGroup>

View file

@ -0,0 +1,11 @@
using BotSharp.Platform.Abstraction;
using BotSharp.Platform.Models;
using System.Threading.Tasks;
namespace BotSharp.Platform.Abstraction
{
public interface IAgentStorageFactory<TAgent> where TAgent : AgentBase
{
Task<IAgentStorage<TAgent>> Get();
}
}

View file

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.Platform.Abstraction
{
public interface IPlatformSettings
{
string BotEngine { get; set; }
string AgentStorage { get; set; }
}
}

View file

@ -2,6 +2,8 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.1.0</Version>
</PropertyGroup>
<ItemGroup>

View file

@ -1,117 +0,0 @@
using BotSharp.Core.Engines;
using BotSharp.NLP;
using BotSharp.Platform.Models;
using BotSharp.RestApi.Integrations.FacebookMessenger;
using DotNetToolkit;
using EntityFrameworkCore.BootKit;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using RestSharp;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BotSharp.RestApi.Integrations
{
[Route("v1/[controller]")]
public class FacebookMessengerController : ControllerBase
{
[HttpGet("{agentId}")]
public ActionResult Verify([FromRoute] string agentId)
{
var mode = Request.Query.ContainsKey("hub.mode") ? Request.Query["hub.mode"].ToString() : String.Empty;
var token = Request.Query.ContainsKey("hub.verify_token") ? Request.Query["hub.verify_token"].ToString() : String.Empty;
var challenge = Request.Query.ContainsKey("hub.challenge") ? Request.Query["hub.challenge"].ToString() : String.Empty;
if (mode == "subscribe")
{
var dc = new DefaultDataContextLoader().GetDefaultDc();
var config = dc.Table<AgentIntegration>().FirstOrDefault(x => x.AgentId == agentId && x.Platform == "Facebook Messenger");
return config.VerifyToken == token ? Ok(challenge) : Ok(agentId);
}
return BadRequest();
}
[HttpPost("{agentId}")]
public async Task<ActionResult> CallbackAsync([FromRoute] string agentId)
{
WebhookEvent body;
IWebhookMessageBody response = null;
using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
{
var json = await reader.ReadToEndAsync();
body = JsonConvert.DeserializeObject<WebhookEvent>(json);
}
body.Entry.ForEach(entry =>
{
entry.Messaging.ForEach(msg =>
{
// received text message
if (msg.Message.ContainsKey("text"))
{
OnTextMessaged(agentId, new WebhookMessage<WebhookTextMessage>
{
Sender = msg.Sender,
Recipient = msg.Recipient,
Timestamp = msg.Timestamp,
Message = msg.Message.ToObject<WebhookTextMessage>()
});
}
});
});
return Ok();
}
private void OnTextMessaged(string agentId, WebhookMessage<WebhookTextMessage> message)
{
Console.WriteLine($"OnTextMessaged: {message.Message.Text}");
/*var ai = new ApiAi();
var agent = ai.LoadAgent(agentId);
ai.AiConfig = new AIConfiguration(agent.ClientAccessToken, SupportedLanguage.English) { AgentId = agentId };
ai.AiConfig.SessionId = message.Sender.Id;
var aiResponse = ai.TextRequest(new AIRequest { Query = new String[] { message.Message.Text } });
var dc = new DefaultDataContextLoader().GetDefaultDc();
var config = dc.Table<AgentIntegration>().FirstOrDefault(x => x.AgentId == agentId && x.Platform == "Facebook Messenger");
SendTextMessage(config.AccessToken, new WebhookMessage<WebhookTextMessage>
{
Recipient = message.Sender.ToObject<WebhookMessageRecipient>(),
Message = new WebhookTextMessage
{
Text = String.IsNullOrEmpty(aiResponse.Result.Fulfillment.Speech) ? aiResponse.Result.Action : aiResponse.Result.Fulfillment.Speech
}
});*/
}
private void SendTextMessage(string accessToken, WebhookMessage<WebhookTextMessage> body)
{
var client = new RestClient("https://graph.facebook.com");
var rest = new RestRequest("v2.6/me/messages", Method.POST);
string json = JsonConvert.SerializeObject(body,
new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
NullValueHandling = NullValueHandling.Ignore
});
rest.AddParameter("application/json", json, ParameterType.RequestBody);
rest.AddQueryParameter("access_token", accessToken);
var response = client.Execute(rest);
}
}
}

View file

@ -1,10 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.RestApi.Integrations.FacebookMessenger
{
public interface IWebhookMessageBody
{
}
}

View file

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.RestApi.Integrations.FacebookMessenger
{
public class WebhookEvent
{
public string Object { get; set; }
public List<WebhookEventEntry> Entry { get; set; }
}
}

View file

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.RestApi.Integrations.FacebookMessenger
{
public class WebhookEventEntry
{
public string Id { get; set; }
public long Time { get; set; }
public List<WebhookMessage> Messaging { get; set; }
}
}

View file

@ -1,29 +0,0 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.RestApi.Integrations.FacebookMessenger
{
public class WebhookMessage
{
public WebhookMessageSender Sender { get; set; }
public WebhookMessageRecipient Recipient { get; set; }
public long Timestamp { get; set; }
public JObject Message { get; set; }
}
public class WebhookMessage<TWebhookMessage> where TWebhookMessage : IWebhookMessageBody
{
public WebhookMessageSender Sender { get; set; }
public WebhookMessageRecipient Recipient { get; set; }
public long Timestamp { get; set; }
public TWebhookMessage Message { get; set; }
}
}

View file

@ -1,11 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.RestApi.Integrations.FacebookMessenger
{
public class WebhookMessageQuickReply
{
public String Payload { get; set; }
}
}

View file

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.RestApi.Integrations.FacebookMessenger
{
public class WebhookMessageRecipient
{
/// <summary>
/// PAGE_ID
/// </summary>
public String Id { get; set; }
}
}

View file

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.RestApi.Integrations.FacebookMessenger
{
public class WebhookMessageSender
{
/// <summary>
/// PSID
/// </summary>
public String Id { get; set; }
}
}

View file

@ -1,15 +0,0 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
namespace BotSharp.RestApi.Integrations.FacebookMessenger
{
public class WebhookTextMessage : IWebhookMessageBody
{
public string Mid { get; set; }
public String Text { get; set; }
[JsonProperty("quick_reply")]
public WebhookMessageQuickReply QuickReply { get; set; }
}
}

View file

@ -4,7 +4,8 @@
<TargetFramework>netcoreapp2.1</TargetFramework>
<RuntimeIdentifiers>Portable;win10-x64;centos.7-x64</RuntimeIdentifiers>
<Platforms>AnyCPU;x64</Platforms>
<Configurations>Debug;Release;DIALOGFLOW;RASA;ARTICULATE</Configurations>
<Configurations>Debug;Release;</Configurations>
<UserSecretsId>4ee89154-9131-4e6b-8fd5-d4f04a8d77c4</UserSecretsId>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@ -18,7 +19,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DIALOGFLOW|AnyCPU'">
<Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE;DIALOGFLOW;NETCOREAPP;NETCOREAPP2_1</DefineConstants>
<DefineConstants>DEBUG;TRACE;NETCOREAPP;NETCOREAPP2_1</DefineConstants>
<OutputPath></OutputPath>
</PropertyGroup>
@ -79,6 +80,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\botsharp-channel-weixin\BotSharp.Channel.Weixin\BotSharp.Channel.Weixin.csproj" />
<ProjectReference Include="..\BotSharp.Core\BotSharp.Core.csproj" />
</ItemGroup>
@ -86,15 +88,9 @@
<Content Update="Settings\app.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Settings\RasaAi.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Settings\DialogflowAi.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Settings\ArticulateAi.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Settings\auth.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

View file

@ -1,7 +0,0 @@
{
"articulateAi": {
"botEngine": "BotSharpNLU",
"agentStorage": "AgentStorageInRedis"
}
}

View file

@ -1,7 +1,7 @@
{
// if you want to override platform setting, please set corresponding value, otherwise you don't need this section.
"dialogflowAi": {
"botEngine": "BotSharpNLU",
"agentStorage": "AgentStorageInMemory"
"agentStorage": "AgentStorageInRedis"
}
}

View file

@ -1,7 +0,0 @@
{
"rasaAi": {
"botEngine": "BotSharpNLU",
"agentStorage": "AgentStorageInMemory"
}
}

View file

@ -8,13 +8,18 @@
"dataDir": "D:\\Projects\\BotSharp\\Data"
},
"moduleBasePath": "D:\\Projects",
"moduleBasePath": "C:\\Users\\haipi\\Documents\\Projects",
"modules": [
{
"Name": "DialogflowAi",
"Type": "BotSharp.Platform.Dialogflow",
"Path": "botsharp-dialogflow\\BotSharp.Platform.Dialogflow\\bin\\Debug\\netstandard2.0"
},
{
"Name": "WeixinChannel",
"Type": "BotSharp.Channel.Weixin",
"Path": "botsharp-channel-weixin\\BotSharp.Channel.Weixin\\bin\\Debug\\netstandard2.0"
} /*,
{
"Name": "RasaAi",
"Type": "BotSharp.Platform.Rasa",
@ -24,6 +29,6 @@
"Name": "ArticulateAi",
"Type": "BotSharp.Platform.Articulate",
"Path": "botsharp-articulate\\BotSharp.Platform.Articulate\\bin\\Debug\\netstandard2.0"
}
}*/
]
}

View file

@ -98,9 +98,11 @@ namespace BotSharp.WebHost
c.DocumentTitle = info.Title;
c.InjectStylesheet(Configuration.GetValue<String>("Swagger:Stylesheet"));
Console.WriteLine();
Console.WriteLine($"{info.Title} [{info.Version}] {info.License.Name}");
Console.WriteLine($"{info.Description}");
Console.WriteLine($"{info.Contact.Name}");
Console.WriteLine($"{info.Contact.Name}, {DateTime.UtcNow.ToString()}");
Console.WriteLine();
});
app.Use(async (context, next) =>
@ -120,6 +122,8 @@ namespace BotSharp.WebHost
app.UseMvc();
this.modulesStartup.Configure(app, env);
AppDomain.CurrentDomain.SetData("DataPath", Path.Combine(env.ContentRootPath, "App_Data"));
AppDomain.CurrentDomain.SetData("Configuration", Configuration);
AppDomain.CurrentDomain.SetData("ContentRootPath", env.ContentRootPath);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View file

@ -22,11 +22,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Abstracti
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Models", "BotSharp.Platform.Models\BotSharp.Platform.Models.csproj", "{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Dialogflow", "..\botsharp-dialogflow\BotSharp.Platform.Dialogflow\BotSharp.Platform.Dialogflow.csproj", "{3599EC12-BE49-4BA2-B02F-86602BC1240C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Dialogflow", "..\botsharp-dialogflow\BotSharp.Platform.Dialogflow\BotSharp.Platform.Dialogflow.csproj", "{4F74387F-7101-428C-B918-38BC5ACCB0A6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Rasa", "..\botsharp-rasa\BotSharp.Platform.Rasa\BotSharp.Platform.Rasa.csproj", "{3DE700F6-16AE-4A14-9119-E72BFBE85AB0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Articulate", "..\botsharp-articulate\BotSharp.Platform.Articulate\BotSharp.Platform.Articulate.csproj", "{ED94ADD1-B8BA-4103-ABF9-662B19E450DD}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Channel.Weixin", "..\botsharp-channel-weixin\BotSharp.Channel.Weixin\BotSharp.Channel.Weixin.csproj", "{0F34140A-3714-4586-8A8C-3ABA56221D06}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -54,10 +52,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 = DIALOGFLOW|Any CPU
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|x64
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|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
@ -122,42 +120,30 @@ Global
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Release|Any CPU.Build.0 = Release|Any CPU
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Release|x64.ActiveCfg = Release|Any CPU
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Release|x64.Build.0 = Release|Any CPU
{3599EC12-BE49-4BA2-B02F-86602BC1240C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3599EC12-BE49-4BA2-B02F-86602BC1240C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3599EC12-BE49-4BA2-B02F-86602BC1240C}.Debug|x64.ActiveCfg = Debug|Any CPU
{3599EC12-BE49-4BA2-B02F-86602BC1240C}.Debug|x64.Build.0 = Debug|Any CPU
{3599EC12-BE49-4BA2-B02F-86602BC1240C}.DIALOGFLOW|Any CPU.ActiveCfg = DIALOGFLOW|Any CPU
{3599EC12-BE49-4BA2-B02F-86602BC1240C}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU
{3599EC12-BE49-4BA2-B02F-86602BC1240C}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|Any CPU
{3599EC12-BE49-4BA2-B02F-86602BC1240C}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|Any CPU
{3599EC12-BE49-4BA2-B02F-86602BC1240C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3599EC12-BE49-4BA2-B02F-86602BC1240C}.Release|Any CPU.Build.0 = Release|Any CPU
{3599EC12-BE49-4BA2-B02F-86602BC1240C}.Release|x64.ActiveCfg = Release|Any CPU
{3599EC12-BE49-4BA2-B02F-86602BC1240C}.Release|x64.Build.0 = Release|Any CPU
{3DE700F6-16AE-4A14-9119-E72BFBE85AB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DE700F6-16AE-4A14-9119-E72BFBE85AB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DE700F6-16AE-4A14-9119-E72BFBE85AB0}.Debug|x64.ActiveCfg = Debug|Any CPU
{3DE700F6-16AE-4A14-9119-E72BFBE85AB0}.Debug|x64.Build.0 = Debug|Any CPU
{3DE700F6-16AE-4A14-9119-E72BFBE85AB0}.DIALOGFLOW|Any CPU.ActiveCfg = Debug|Any CPU
{3DE700F6-16AE-4A14-9119-E72BFBE85AB0}.DIALOGFLOW|Any CPU.Build.0 = Debug|Any CPU
{3DE700F6-16AE-4A14-9119-E72BFBE85AB0}.DIALOGFLOW|x64.ActiveCfg = Debug|Any CPU
{3DE700F6-16AE-4A14-9119-E72BFBE85AB0}.DIALOGFLOW|x64.Build.0 = Debug|Any CPU
{3DE700F6-16AE-4A14-9119-E72BFBE85AB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DE700F6-16AE-4A14-9119-E72BFBE85AB0}.Release|Any CPU.Build.0 = Release|Any CPU
{3DE700F6-16AE-4A14-9119-E72BFBE85AB0}.Release|x64.ActiveCfg = Release|Any CPU
{3DE700F6-16AE-4A14-9119-E72BFBE85AB0}.Release|x64.Build.0 = Release|Any CPU
{ED94ADD1-B8BA-4103-ABF9-662B19E450DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ED94ADD1-B8BA-4103-ABF9-662B19E450DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ED94ADD1-B8BA-4103-ABF9-662B19E450DD}.Debug|x64.ActiveCfg = Debug|Any CPU
{ED94ADD1-B8BA-4103-ABF9-662B19E450DD}.Debug|x64.Build.0 = Debug|Any CPU
{ED94ADD1-B8BA-4103-ABF9-662B19E450DD}.DIALOGFLOW|Any CPU.ActiveCfg = Debug|Any CPU
{ED94ADD1-B8BA-4103-ABF9-662B19E450DD}.DIALOGFLOW|Any CPU.Build.0 = Debug|Any CPU
{ED94ADD1-B8BA-4103-ABF9-662B19E450DD}.DIALOGFLOW|x64.ActiveCfg = Debug|Any CPU
{ED94ADD1-B8BA-4103-ABF9-662B19E450DD}.DIALOGFLOW|x64.Build.0 = Debug|Any CPU
{ED94ADD1-B8BA-4103-ABF9-662B19E450DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ED94ADD1-B8BA-4103-ABF9-662B19E450DD}.Release|Any CPU.Build.0 = Release|Any CPU
{ED94ADD1-B8BA-4103-ABF9-662B19E450DD}.Release|x64.ActiveCfg = Release|Any CPU
{ED94ADD1-B8BA-4103-ABF9-662B19E450DD}.Release|x64.Build.0 = Release|Any CPU
{4F74387F-7101-428C-B918-38BC5ACCB0A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4F74387F-7101-428C-B918-38BC5ACCB0A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F74387F-7101-428C-B918-38BC5ACCB0A6}.Debug|x64.ActiveCfg = Debug|Any CPU
{4F74387F-7101-428C-B918-38BC5ACCB0A6}.Debug|x64.Build.0 = Debug|Any CPU
{4F74387F-7101-428C-B918-38BC5ACCB0A6}.DIALOGFLOW|Any CPU.ActiveCfg = DIALOGFLOW|Any CPU
{4F74387F-7101-428C-B918-38BC5ACCB0A6}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU
{4F74387F-7101-428C-B918-38BC5ACCB0A6}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|Any CPU
{4F74387F-7101-428C-B918-38BC5ACCB0A6}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|Any CPU
{4F74387F-7101-428C-B918-38BC5ACCB0A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F74387F-7101-428C-B918-38BC5ACCB0A6}.Release|Any CPU.Build.0 = Release|Any CPU
{4F74387F-7101-428C-B918-38BC5ACCB0A6}.Release|x64.ActiveCfg = Release|Any CPU
{4F74387F-7101-428C-B918-38BC5ACCB0A6}.Release|x64.Build.0 = Release|Any CPU
{0F34140A-3714-4586-8A8C-3ABA56221D06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0F34140A-3714-4586-8A8C-3ABA56221D06}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F34140A-3714-4586-8A8C-3ABA56221D06}.Debug|x64.ActiveCfg = Debug|Any CPU
{0F34140A-3714-4586-8A8C-3ABA56221D06}.Debug|x64.Build.0 = Debug|Any CPU
{0F34140A-3714-4586-8A8C-3ABA56221D06}.DIALOGFLOW|Any CPU.ActiveCfg = Debug|Any CPU
{0F34140A-3714-4586-8A8C-3ABA56221D06}.DIALOGFLOW|Any CPU.Build.0 = Debug|Any CPU
{0F34140A-3714-4586-8A8C-3ABA56221D06}.DIALOGFLOW|x64.ActiveCfg = Debug|Any CPU
{0F34140A-3714-4586-8A8C-3ABA56221D06}.DIALOGFLOW|x64.Build.0 = Debug|Any CPU
{0F34140A-3714-4586-8A8C-3ABA56221D06}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F34140A-3714-4586-8A8C-3ABA56221D06}.Release|Any CPU.Build.0 = Release|Any CPU
{0F34140A-3714-4586-8A8C-3ABA56221D06}.Release|x64.ActiveCfg = Release|Any CPU
{0F34140A-3714-4586-8A8C-3ABA56221D06}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -1,4 +1,4 @@
The Open Source AI Bot Platform Builder
The Open Source AI Chatbot Platform Builder
======================================================
.. image:: https://img.shields.io/badge/gitter-join%20chat-brightgreen.svg
@ -58,6 +58,16 @@ You can use docker compose to run BotSharp quickly, make sure you've got `Docker
Point your web browser at http://localhost:3000 and enjoy BotSharp with Articulate-UI.
Extension Libraries
-----------------
BotSharp uses component design, the kernel is kept to a minimum, and business functions are implemented by external components. The modular design also allows contributors to better participate.
* BotSharp platform emulator extension which is compatible with RASA NLU. `botsharp-rasa`_
* BotSharp platform emulator extension which is compatible with Google Dialogflow. `botsharp-dialogflow`_
* BotSharp platform emulator extension which is compatible with Articulate AI. `botsharp-articulate`_
* A channel module of BotSharp for Facebook Messenger. `botsharp-channel-fbmessenger`_
* A channel module of BotSharp for Tencent Weixin. `botsharp-channel-weixin`_
* Articulate UI customized for BotSharp NLU. `articulate-ui`_
Documents
---------
@ -82,4 +92,9 @@ Scan to join group in Wechat
.. _gitter: https://gitter.im/botsharpcore/Lobby
.. _license: https://raw.githubusercontent.com/Oceania2018/BotSharp/master/LICENSE
.. _botsharpnuget: https://www.nuget.org/packages/BotSharp.Core
.. _botsharp-rasa: https://github.com/Oceania2018/botsharp-rasa
.. _botsharp-dialogflow: https://github.com/Oceania2018/botsharp-dialogflow
.. _botsharp-articulate: https://github.com/Oceania2018/botsharp-articulate
.. _botsharp-channel-fbmessenger: https://github.com/Oceania2018/botsharp-channel-fbmessenger
.. _botsharp-channel-weixin: https://github.com/Oceania2018/botsharp-channel-weixin
.. _articulate-ui: https://github.com/Oceania2018/articulate-ui

View file

@ -57,6 +57,15 @@ You can use docker compose to run BotSharp quickly, make sure you've got `Docker
Point your web browser at http://localhost:3000 and enjoy BotSharp with Articulate-UI.
Extension Libraries
-----------------
BotSharp uses component design, the kernel is kept to a minimum, and business functions are implemented by external components. The modular design also allows contributors to better participate.
* BotSharp platform emulator extension which is compatible with RASA NLU. `botsharp-rasa`_
* BotSharp platform emulator extension which is compatible with Google Dialogflow. `botsharp-dialogflow`_
* BotSharp platform emulator extension which is compatible with Articulate AI. `botsharp-articulate`_
* A channel module of BotSharp for Facebook Messenger. `botsharp-channel-fbmessenger`_
* A channel module of BotSharp for Tencent Weixin. `botsharp-channel-weixin`_
Documents
---------
@ -81,4 +90,9 @@ Scan to join group in Wechat
.. _gitter: https://gitter.im/botsharpcore/Lobby
.. _license: https://raw.githubusercontent.com/Oceania2018/BotSharp/master/LICENSE
.. _botsharpnuget: https://www.nuget.org/packages/BotSharp.Core
.. _botsharp-rasa: https://github.com/Oceania2018/botsharp-rasa
.. _botsharp-dialogflow: https://github.com/Oceania2018/botsharp-dialogflow
.. _botsharp-articulate: https://github.com/Oceania2018/botsharp-articulate
.. _botsharp-channel-fbmessenger: https://github.com/Oceania2018/botsharp-channel-fbmessenger
.. _botsharp-channel-weixin: https://github.com/Oceania2018/botsharp-channel-weixin

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 105 KiB