remove articulate emulator
This commit is contained in:
parent
ea4b401f83
commit
fdd0cb6778
|
|
@ -63,12 +63,8 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BotSharp.Core\BotSharp.Core.csproj" />
|
||||
<ProjectReference Include="..\BotSharp.Platform.Abstraction\BotSharp.Platform.Abstraction.csproj" />
|
||||
<ProjectReference Include="..\BotSharp.RestApi\BotSharp.RestApi.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Colorful.Console" Version="1.2.9" />
|
||||
<PackageReference Include="DotNetToolkit" Version="1.6.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.1.1" />
|
||||
|
|
@ -78,6 +74,10 @@
|
|||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\botsharp-articulate\BotSharp.Platform.Articulate\BotSharp.Platform.Articulate.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="Settings\app.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using BotSharp.Core.Abstractions;
|
||||
using DotNetToolkit;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
|
@ -13,12 +11,12 @@ namespace BotSharp.WebHost
|
|||
public IConfiguration Config { get; set; }
|
||||
public void Load()
|
||||
{
|
||||
var assemblies = (string[])AppDomain.CurrentDomain.GetData("Assemblies");
|
||||
/*var assemblies = (string[])AppDomain.CurrentDomain.GetData("Assemblies");
|
||||
var appsLoaders1 = TypeHelper.GetInstanceWithInterface<IInitializationLoader>(assemblies);
|
||||
appsLoaders1.ForEach(loader =>
|
||||
{
|
||||
loader.Initialize(Config, Env);
|
||||
});
|
||||
});*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace BotSharp.WebHost
|
|||
config.AddJsonFile(setting, optional: false, reloadOnChange: true);
|
||||
});
|
||||
})
|
||||
.UseUrls("http://0.0.0.0:3112")
|
||||
.UseUrls("http://0.0.0.0:7500")
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
},
|
||||
|
||||
"botSharpIntentClassifier": {
|
||||
"classifer": "SVMClassifier",
|
||||
"classifer": "NaiveBayesClassifier",
|
||||
"wordvecModel": "|App_Data|wordvec_enu.bin"
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ using System.Collections.Generic;
|
|||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Console = Colorful.Console;
|
||||
|
||||
namespace BotSharp.WebHost
|
||||
|
|
@ -56,8 +57,9 @@ namespace BotSharp.WebHost
|
|||
var info = Configuration.GetSection("Swagger").Get<Info>();
|
||||
c.SwaggerDoc(info.Version, info);
|
||||
|
||||
var filePath = Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, "BotSharp.RestApi.xml");
|
||||
c.IncludeXmlComments(filePath);
|
||||
//var filePath = Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, "BotSharp.RestApi.xml");
|
||||
//c.IncludeXmlComments(filePath);
|
||||
|
||||
c.OperationFilter<SwaggerFileUploadOperation>();
|
||||
});
|
||||
|
||||
|
|
@ -124,6 +126,13 @@ namespace BotSharp.WebHost
|
|||
loader.Config = Configuration;
|
||||
loader.Load();*/
|
||||
|
||||
// load dll dynamic
|
||||
/*Assembly library = Assembly.LoadFile(Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, "BotSharp.Platform.Articulate.dll"));
|
||||
Type myClass = (from type in library.GetExportedTypes()
|
||||
where typeof(IMyInterface).IsAssignableFrom(type)
|
||||
select type)
|
||||
.Single();*/
|
||||
|
||||
var platform = Configuration.GetValue<string>("Platform");
|
||||
var engine = Configuration.GetValue<string>($"{platform}:BotEngine");
|
||||
Formatter[] settings = new Formatter[]
|
||||
|
|
|
|||
28
BotSharp.sln
28
BotSharp.sln
|
|
@ -5,8 +5,6 @@ VisualStudioVersion = 15.0.27130.2010
|
|||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Core", "BotSharp.Core\BotSharp.Core.csproj", "{95780673-2A1A-4953-962F-C46CBFDD07FF}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.RestApi", "BotSharp.RestApi\BotSharp.RestApi.csproj", "{80DDAA05-69BC-49DD-96A4-37345E7A2E20}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.WebHost", "BotSharp.WebHost\BotSharp.WebHost.csproj", "{03DCA427-327A-4FC9-9A2F-57D17F16708C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22} = {C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}
|
||||
|
|
@ -26,7 +24,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Models",
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Dialogflow", "..\botsharp-dialogflow\BotSharp.Platform.Dialogflow\BotSharp.Platform.Dialogflow.csproj", "{B865F070-9693-47C6-B901-40121F659C6F}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Platform.Articulate", "Platform.Articulate\Platform.Articulate.csproj", "{9B7D2034-55A0-4539-A7A5-FAA7117E16A6}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Articulate", "..\botsharp-articulate\BotSharp.Platform.Articulate\BotSharp.Platform.Articulate.csproj", "{17BAE152-DDCF-4605-8DCB-9F14D403002F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
@ -44,14 +42,6 @@ Global
|
|||
{95780673-2A1A-4953-962F-C46CBFDD07FF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{95780673-2A1A-4953-962F-C46CBFDD07FF}.Release|x64.ActiveCfg = Release|x64
|
||||
{95780673-2A1A-4953-962F-C46CBFDD07FF}.Release|x64.Build.0 = Release|x64
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.Debug|x64.Build.0 = Debug|x64
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.Release|x64.ActiveCfg = Release|x64
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.Release|x64.Build.0 = Release|x64
|
||||
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
|
|
@ -108,14 +98,14 @@ Global
|
|||
{B865F070-9693-47C6-B901-40121F659C6F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B865F070-9693-47C6-B901-40121F659C6F}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{B865F070-9693-47C6-B901-40121F659C6F}.Release|x64.Build.0 = Release|Any CPU
|
||||
{9B7D2034-55A0-4539-A7A5-FAA7117E16A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9B7D2034-55A0-4539-A7A5-FAA7117E16A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9B7D2034-55A0-4539-A7A5-FAA7117E16A6}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{9B7D2034-55A0-4539-A7A5-FAA7117E16A6}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{9B7D2034-55A0-4539-A7A5-FAA7117E16A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9B7D2034-55A0-4539-A7A5-FAA7117E16A6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9B7D2034-55A0-4539-A7A5-FAA7117E16A6}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{9B7D2034-55A0-4539-A7A5-FAA7117E16A6}.Release|x64.Build.0 = Release|Any CPU
|
||||
{17BAE152-DDCF-4605-8DCB-9F14D403002F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{17BAE152-DDCF-4605-8DCB-9F14D403002F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{17BAE152-DDCF-4605-8DCB-9F14D403002F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{17BAE152-DDCF-4605-8DCB-9F14D403002F}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{17BAE152-DDCF-4605-8DCB-9F14D403002F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{17BAE152-DDCF-4605-8DCB-9F14D403002F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{17BAE152-DDCF-4605-8DCB-9F14D403002F}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{17BAE152-DDCF-4605-8DCB-9F14D403002F}.Release|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
|||
|
|
@ -1,185 +0,0 @@
|
|||
using BotSharp.Core;
|
||||
using BotSharp.Core.Engines;
|
||||
using BotSharp.Models.NLP;
|
||||
using BotSharp.Platform.Abstraction;
|
||||
using BotSharp.Platform.Models;
|
||||
using BotSharp.Platform.Models.AiRequest;
|
||||
using BotSharp.Platform.Models.AiResponse;
|
||||
using BotSharp.Platform.Models.MachineLearning;
|
||||
using DotNetToolkit;
|
||||
using Platform.Articulate.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Platform.Articulate
|
||||
{
|
||||
/// <summary>
|
||||
/// A platform for building conversational interfaces with intelligent agents (chatbots)
|
||||
/// http://spg.ai/projects/articulate
|
||||
/// This implementation takes over APIs of Articulate's 7500 port.
|
||||
/// </summary>
|
||||
public class ArticulateAi<TAgent> :
|
||||
PlatformBuilderBase<TAgent>,
|
||||
IPlatformBuilder<TAgent>
|
||||
where TAgent : AgentModel
|
||||
{
|
||||
public DialogRequestOptions RequestOptions { get; set; }
|
||||
|
||||
public Tuple<TAgent, DomainModel> GetAgentByDomainId(String domainId)
|
||||
{
|
||||
var results = GetAllAgents();
|
||||
|
||||
foreach (TAgent agent in results)
|
||||
{
|
||||
var domain = agent.Domains.FirstOrDefault(x => x.Id == domainId);
|
||||
|
||||
if (domain != null)
|
||||
{
|
||||
return new Tuple<TAgent, DomainModel>(agent, domain);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Tuple<TAgent, DomainModel, IntentModel> GetAgentByIntentId(String intentId)
|
||||
{
|
||||
var results = GetAllAgents();
|
||||
|
||||
foreach (TAgent agent in results)
|
||||
{
|
||||
foreach (DomainModel domain in agent.Domains)
|
||||
{
|
||||
var intent = domain.Intents.FirstOrDefault(x => x.Id == intentId);
|
||||
if (intent != null)
|
||||
{
|
||||
return new Tuple<TAgent, DomainModel, IntentModel>(agent, domain, intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<IntentModel> GetReferencedIntentsByEntity(string entityId)
|
||||
{
|
||||
var intents = new List<IntentModel>();
|
||||
var allAgents = GetAllAgents();
|
||||
foreach (TAgent agent in allAgents)
|
||||
{
|
||||
foreach (DomainModel domain in agent.Domains)
|
||||
{
|
||||
foreach (IntentModel intent in domain.Intents)
|
||||
{
|
||||
if(intent.Examples.Exists(x => x.Entities.Exists(y => y.EntityId == entityId)))
|
||||
{
|
||||
intents.Add(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return intents;
|
||||
}
|
||||
|
||||
public TrainingCorpus ExtractorCorpus(TAgent agent)
|
||||
{
|
||||
var corpus = new TrainingCorpus();
|
||||
corpus.Entities = agent.Entities.Select(x => new TrainingEntity
|
||||
{
|
||||
Entity = x.EntityName,
|
||||
Values = x.Examples.Select(y => new TrainingEntitySynonym
|
||||
{
|
||||
Value = y.Value,
|
||||
Synonyms = y.Synonyms
|
||||
}).ToList()
|
||||
}).ToList();
|
||||
|
||||
corpus.UserSays = new List<TrainingIntentExpression<TrainingIntentExpressionPart>>();
|
||||
|
||||
foreach(DomainModel domain in agent.Domains)
|
||||
{
|
||||
foreach(IntentModel intent in domain.Intents)
|
||||
{
|
||||
foreach(IntentExampleModel example in intent.Examples)
|
||||
{
|
||||
var say = new TrainingIntentExpression<TrainingIntentExpressionPart>()
|
||||
{
|
||||
Intent = intent.IntentName,
|
||||
Text = example.UserSays,
|
||||
Entities = example.Entities.Select(x => new TrainingIntentExpressionPart
|
||||
{
|
||||
Entity = x.Entity,
|
||||
Start = x.Start,
|
||||
Value = x.Value
|
||||
}).ToList()
|
||||
};
|
||||
|
||||
corpus.UserSays.Add(say);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return corpus;
|
||||
}
|
||||
|
||||
public override bool SaveAgent(TAgent agent)
|
||||
{
|
||||
agent.Status = "Changed";
|
||||
agent.LastTraining = DateTime.UtcNow;
|
||||
return base.SaveAgent(agent);
|
||||
}
|
||||
|
||||
public async Task<ModelMetaData> Train(TAgent agent, TrainingCorpus corpus)
|
||||
{
|
||||
string agentDir = Path.Combine(AppDomain.CurrentDomain.GetData("DataPath").ToString(), "Projects", agent.Id);
|
||||
var model = "model_" + DateTime.UtcNow.ToString("yyyyMMdd");
|
||||
|
||||
var trainer = new BotTrainer();
|
||||
agent.Corpus = corpus;
|
||||
|
||||
var trainOptions = new BotTrainOptions
|
||||
{
|
||||
AgentDir = agentDir,
|
||||
Model = model
|
||||
};
|
||||
|
||||
var info = await trainer.Train(agent, trainOptions);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
public AiResponse TextRequest(AiRequest request)
|
||||
{
|
||||
var aiResponse = new AiResponse();
|
||||
|
||||
// Load agent
|
||||
var projectPath = Path.Combine(AppDomain.CurrentDomain.GetData("DataPath").ToString(), "Projects", request.AgentId);
|
||||
var model = Directory.GetDirectories(projectPath).Where(x => x.Contains("model_")).Last().Split(Path.DirectorySeparatorChar).Last();
|
||||
var modelPath = Path.Combine(projectPath, model);
|
||||
request.AgentDir = projectPath;
|
||||
request.Model = model;
|
||||
|
||||
var agent = GetAgentById(request.AgentId);
|
||||
|
||||
var preditor = new BotPredictor();
|
||||
var doc = preditor.Predict(agent, request).Result;
|
||||
|
||||
var parameters = new Dictionary<String, Object>();
|
||||
if (doc.Sentences[0].Entities == null)
|
||||
{
|
||||
doc.Sentences[0].Entities = new List<NlpEntity>();
|
||||
}
|
||||
doc.Sentences[0].Entities.ForEach(x => parameters[x.Entity] = x.Value);
|
||||
|
||||
aiResponse.Intent = doc.Sentences[0].Intent.Label;
|
||||
aiResponse.Speech = aiResponse.Intent;
|
||||
|
||||
return aiResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
using BotSharp.Core;
|
||||
using BotSharp.Core.Engines;
|
||||
using BotSharp.Platform.Abstraction;
|
||||
using BotSharp.Platform.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using Platform.Articulate;
|
||||
using Platform.Articulate.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Platform.Articulate.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
public class AgentController : ControllerBase
|
||||
{
|
||||
private readonly IBotEngine _platform;
|
||||
private ArticulateAi<AgentModel> builder;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize agent controller and get a platform instance
|
||||
/// </summary>
|
||||
/// <param name="platform"></param>
|
||||
public AgentController(IBotEngine platform, IConfiguration configuration)
|
||||
{
|
||||
_platform = platform;
|
||||
builder = new ArticulateAi<AgentModel>();
|
||||
builder.PlatformConfig = configuration.GetSection("ArticulateAi");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public AgentModel PostAgent()
|
||||
{
|
||||
AgentModel agent = null;
|
||||
|
||||
using (var reader = new StreamReader(Request.Body))
|
||||
{
|
||||
string body = reader.ReadToEnd();
|
||||
agent = JsonConvert.DeserializeObject<AgentModel>(body);
|
||||
}
|
||||
|
||||
// convert to standard Agent structure
|
||||
agent.Id = new Random().Next(Int32.MaxValue).ToString();
|
||||
agent.Name = agent.AgentName;
|
||||
builder.SaveAgent(agent);
|
||||
|
||||
return agent;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<AgentModel> GetAgent()
|
||||
{
|
||||
var results = builder.GetAllAgents();
|
||||
var agents = results.ToList();
|
||||
|
||||
return agents;
|
||||
}
|
||||
|
||||
[HttpGet("{agentId}")]
|
||||
public AgentModel GetAgentById([FromRoute] string agentId)
|
||||
{
|
||||
var agent = builder.GetAgentById(agentId);
|
||||
|
||||
return agent;
|
||||
}
|
||||
|
||||
[HttpGet("name/{agentName}")]
|
||||
public AgentModel GetAgentByName([FromRoute] string agentName)
|
||||
{
|
||||
var agent = builder.GetAgentByName(agentName);
|
||||
|
||||
return agent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
using BotSharp.Core;
|
||||
using BotSharp.Platform.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Platform.Articulate.Models;
|
||||
using Platform.Articulate.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Platform.Articulate.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
public class DomainController : ControllerBase
|
||||
{
|
||||
private readonly IConfiguration configuration;
|
||||
private ArticulateAi<AgentModel> builder;
|
||||
|
||||
public DomainController(IConfiguration configuration)
|
||||
{
|
||||
builder = new ArticulateAi<AgentModel>();
|
||||
builder.PlatformConfig = configuration.GetSection("ArticulateAi");
|
||||
}
|
||||
|
||||
[HttpGet("{domainId}")]
|
||||
public DomainModel GetDomain([FromRoute] int domainId)
|
||||
{
|
||||
string dataDir = Path.Combine(AppDomain.CurrentDomain.GetData("DataPath").ToString(), "Articulate");
|
||||
|
||||
var dataPath = Directory.GetFiles(dataDir).FirstOrDefault(x => Regex.IsMatch(x, $"-domain-{domainId}.json"));
|
||||
string json = System.IO.File.ReadAllText(dataPath);
|
||||
|
||||
var domain = JsonConvert.DeserializeObject<DomainModel>(json);
|
||||
|
||||
return domain;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public DomainModel PostDomain()
|
||||
{
|
||||
DomainModel domain = null;
|
||||
|
||||
using (var reader = new StreamReader(Request.Body))
|
||||
{
|
||||
string body = reader.ReadToEnd();
|
||||
domain = JsonConvert.DeserializeObject<DomainModel>(body);
|
||||
}
|
||||
|
||||
var agent = builder.GetAgentByName(domain.Agent);
|
||||
domain.Id = Guid.NewGuid().ToString();
|
||||
(agent as AgentModel).Domains.Add(domain);
|
||||
builder.SaveAgent(agent);
|
||||
|
||||
return domain;
|
||||
}
|
||||
|
||||
[HttpGet("/agent/{agentId}/domain")]
|
||||
public DomainPageViewModel GetAgentDomains([FromRoute] string agentId, [FromQuery] int start, [FromQuery] int limit)
|
||||
{
|
||||
var agent = builder.GetAgentById(agentId);
|
||||
|
||||
return new DomainPageViewModel { Domains = agent.Domains, Total = agent.Domains.Count };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
using BotSharp.Core;
|
||||
using BotSharp.Platform.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using Platform.Articulate.Models;
|
||||
using Platform.Articulate.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
public class EntityController : ControllerBase
|
||||
{
|
||||
private readonly IConfiguration configuration;
|
||||
private ArticulateAi<AgentModel> builder;
|
||||
|
||||
public EntityController(IConfiguration configuration)
|
||||
{
|
||||
builder = new ArticulateAi<AgentModel>();
|
||||
builder.PlatformConfig = configuration.GetSection("ArticulateAi");
|
||||
}
|
||||
|
||||
[HttpGet("{entityId}")]
|
||||
public EntityModel GetEntity([FromRoute] string entityId)
|
||||
{
|
||||
string dataDir = Path.Combine(AppDomain.CurrentDomain.GetData("DataPath").ToString(), "Articulate");
|
||||
|
||||
string dataPath = Directory.GetFiles(dataDir).FirstOrDefault(x => x.EndsWith($"-entity-{entityId}.json"));
|
||||
|
||||
string json = System.IO.File.ReadAllText(dataPath);
|
||||
|
||||
var entity = JsonConvert.DeserializeObject<EntityModel>(json);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
[HttpGet("/agent/{agentId}/entity")]
|
||||
public EntityPageViewModel GetAgentEntities([FromRoute] string agentId, [FromQuery] int start, [FromQuery] int limit)
|
||||
{
|
||||
var agent = builder.GetAgentById(agentId);
|
||||
return new EntityPageViewModel { Entities = agent.Entities.Select(x => x as EntityModel).ToList(), Total = agent.Entities.Count };
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public EntityModel PostEntity()
|
||||
{
|
||||
EntityModel entity = null;
|
||||
|
||||
using (var reader = new StreamReader(Request.Body))
|
||||
{
|
||||
string body = reader.ReadToEnd();
|
||||
entity = JsonConvert.DeserializeObject<EntityModel>(body);
|
||||
}
|
||||
|
||||
var agent = builder.GetAgentByName(entity.Agent);
|
||||
entity.Id = Guid.NewGuid().ToString();
|
||||
agent.Entities.Add(entity);
|
||||
|
||||
builder.SaveAgent(agent);
|
||||
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,129 +0,0 @@
|
|||
using BotSharp.Core;
|
||||
using BotSharp.Platform.Models;
|
||||
using DotNetToolkit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using Platform.Articulate.Models;
|
||||
using Platform.Articulate.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
public class IntentController : ControllerBase
|
||||
{
|
||||
private readonly IConfiguration configuration;
|
||||
private ArticulateAi<AgentModel> builder;
|
||||
|
||||
public IntentController(IConfiguration configuration)
|
||||
{
|
||||
builder = new ArticulateAi<AgentModel>();
|
||||
builder.PlatformConfig = configuration.GetSection("ArticulateAi");
|
||||
}
|
||||
|
||||
[HttpGet("{intentId}")]
|
||||
public IntentViewModel GetIntent([FromRoute] string intentId)
|
||||
{
|
||||
var agent = builder.GetAgentByIntentId(intentId);
|
||||
|
||||
return agent.Item3.ToObject<IntentViewModel>();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IntentViewModel PostIntent()
|
||||
{
|
||||
IntentViewModel intent = null;
|
||||
|
||||
using (var reader = new StreamReader(Request.Body))
|
||||
{
|
||||
string body = reader.ReadToEnd();
|
||||
intent = JsonConvert.DeserializeObject<IntentViewModel>(body);
|
||||
}
|
||||
|
||||
var agent = builder.GetAgentByName(intent.Agent);
|
||||
intent.Id = Guid.NewGuid().ToString();
|
||||
var domain = agent.Domains.First(x => x.DomainName == intent.Domain);
|
||||
domain.Intents.Add(intent.ToObject<IntentModel>());
|
||||
builder.SaveAgent(agent);
|
||||
|
||||
return intent;
|
||||
}
|
||||
|
||||
[HttpPut("{intentId}")]
|
||||
public IntentViewModel PutIntent([FromRoute] string intentId)
|
||||
{
|
||||
IntentViewModel intent = null;
|
||||
|
||||
using (var reader = new StreamReader(Request.Body))
|
||||
{
|
||||
string body = reader.ReadToEnd();
|
||||
intent = JsonConvert.DeserializeObject<IntentViewModel>(body);
|
||||
}
|
||||
|
||||
var agent = builder.GetAgentByIntentId(intentId);
|
||||
|
||||
var updateAgent = agent.Item1;
|
||||
var updateIntents = updateAgent.Domains.First(x => x.Id == agent.Item2.Id).Intents;
|
||||
var updateIntent = updateIntents.First(x => x.Id == agent.Item3.Id);
|
||||
|
||||
updateIntent.IntentName = intent.IntentName;
|
||||
updateIntent.Examples = intent.Examples;
|
||||
|
||||
builder.SaveAgent(updateAgent);
|
||||
|
||||
return intent;
|
||||
}
|
||||
|
||||
[HttpGet("{intentId}/webhook")]
|
||||
public void GetIntentWebhook([FromRoute] string intentId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[HttpGet("{intentId}/postFormat")]
|
||||
public void GetIntentPostFormat([FromRoute] string intentId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[HttpGet("/agent/{agentId}/intent")]
|
||||
public IntentPageViewModel GetAgentIntents([FromRoute] string agentId, [FromQuery] int start, [FromQuery] int limit)
|
||||
{
|
||||
var intents = new List<IntentViewModel>();
|
||||
|
||||
string dataDir = Path.Combine(AppDomain.CurrentDomain.GetData("DataPath").ToString(), "Articulate");
|
||||
|
||||
var agentPaths = Directory.GetFiles(dataDir).Where(x => x.Contains($"agent-{agentId}-intent-")).ToList();
|
||||
for (int i = 0; i < agentPaths.Count; i++)
|
||||
{
|
||||
string json = System.IO.File.ReadAllText(agentPaths[i]);
|
||||
|
||||
var intent = JsonConvert.DeserializeObject<IntentViewModel>(json);
|
||||
|
||||
intents.Add(intent);
|
||||
}
|
||||
|
||||
return new IntentPageViewModel { Intents = intents, Total = intents.Count };
|
||||
}
|
||||
|
||||
[HttpGet("/entity/{entityId}/intent")]
|
||||
public List<IntentViewModel> GetReferencedIntentsByEntity([FromRoute] string entityId, [FromQuery] int start, [FromQuery] int limit)
|
||||
{
|
||||
return builder.GetReferencedIntentsByEntity(entityId).Select(x => x.ToObject<IntentViewModel>()).ToList();
|
||||
}
|
||||
|
||||
[HttpGet("/domain/{domainId}/intent")]
|
||||
public IntentPageViewModel GetReferencedIntentsByDomain([FromRoute] string domainId, [FromQuery] int start, [FromQuery] int limit)
|
||||
{
|
||||
var agent = builder.GetAgentByDomainId(domainId);
|
||||
var intents = agent.Item2.Intents.Select(x => x.ToObject<IntentViewModel>()).ToList();
|
||||
|
||||
return new IntentPageViewModel { Intents = intents, Total = intents.Count };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
using BotSharp.NLP;
|
||||
using BotSharp.Platform.Models.AiRequest;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Platform.Articulate.Models;
|
||||
using Platform.Articulate.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Console = Colorful.Console;
|
||||
|
||||
namespace Platform.Articulate.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
public class ParseControllercs : ControllerBase
|
||||
{
|
||||
private readonly IConfiguration configuration;
|
||||
private ArticulateAi<AgentModel> builder;
|
||||
|
||||
public ParseControllercs(IConfiguration configuration)
|
||||
{
|
||||
builder = new ArticulateAi<AgentModel>();
|
||||
builder.PlatformConfig = configuration.GetSection("ArticulateAi");
|
||||
}
|
||||
|
||||
[HttpGet("/agent/{agentId}/converse")]
|
||||
public ActionResult ParseText([FromRoute] string agentId, [FromQuery] string text, [FromQuery] string sessionId)
|
||||
{
|
||||
var response = new ResponseViewModel();
|
||||
|
||||
Console.WriteLine($"Got message from {Request.Host}: {text}", Color.Green);
|
||||
|
||||
var aiResponse = builder.TextRequest(new AiRequest
|
||||
{
|
||||
AgentId = agentId,
|
||||
Text = text
|
||||
});
|
||||
|
||||
response.TextResponse = aiResponse.Speech;
|
||||
|
||||
return Ok(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
using BotSharp.Core;
|
||||
using DotNetToolkit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using Platform.Articulate.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
public class ScenarioController : ControllerBase
|
||||
{
|
||||
private readonly IConfiguration configuration;
|
||||
private ArticulateAi<AgentModel> builder;
|
||||
|
||||
public ScenarioController(IConfiguration configuration)
|
||||
{
|
||||
builder = new ArticulateAi<AgentModel>();
|
||||
builder.PlatformConfig = configuration.GetSection("ArticulateAi");
|
||||
}
|
||||
|
||||
[HttpGet("/intent/{intentId}/scenario")]
|
||||
public IntentScenarioViewModel GetIntentScenario([FromRoute] string intentId)
|
||||
{
|
||||
var agent = builder.GetAgentByIntentId(intentId);
|
||||
|
||||
var view = agent.Item3.Scenario.ToObject<IntentScenarioViewModel>();
|
||||
|
||||
view.Agent = agent.Item1.AgentName;
|
||||
view.Domain = agent.Item2.DomainName;
|
||||
view.Intent = agent.Item3.IntentName;
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
[HttpPost("/intent/{intentId}/scenario")]
|
||||
public IntentScenarioViewModel PostIntentScenario()
|
||||
{
|
||||
IntentScenarioViewModel scenario = null;
|
||||
|
||||
using (var reader = new StreamReader(Request.Body))
|
||||
{
|
||||
string body = reader.ReadToEnd();
|
||||
scenario = JsonConvert.DeserializeObject<IntentScenarioViewModel>(body);
|
||||
}
|
||||
|
||||
scenario.Id = Guid.NewGuid().ToString();
|
||||
|
||||
var agent = builder.GetAgentByName(scenario.Agent);
|
||||
|
||||
var domain = agent.Domains.FirstOrDefault(x => x.DomainName == scenario.Domain);
|
||||
var intent = domain.Intents.FirstOrDefault(x => x.IntentName == scenario.Intent);
|
||||
intent.Scenario = scenario.ToObject<ScenarioModel>();
|
||||
|
||||
builder.SaveAgent(agent);
|
||||
|
||||
return scenario;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using Platform.Articulate.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
public class SettingsController : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public SettingsModel GetSettings()
|
||||
{
|
||||
string dataPath = Path.Combine(AppDomain.CurrentDomain.GetData("DataPath").ToString(), "Articulate", "settings.json");
|
||||
|
||||
string json = System.IO.File.ReadAllText(dataPath);
|
||||
|
||||
var settings = JsonConvert.DeserializeObject<SettingsModel>(json);
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
[HttpGet("/agent/{agentId}/settings")]
|
||||
public SettingsModel GetSettingsByAgent([FromRoute] string agentId)
|
||||
{
|
||||
string dataPath = Path.Combine(AppDomain.CurrentDomain.GetData("DataPath").ToString(), "Articulate", "settings.json");
|
||||
|
||||
string json = System.IO.File.ReadAllText(dataPath);
|
||||
|
||||
var settings = JsonConvert.DeserializeObject<SettingsModel>(json);
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
[HttpPut("/agent/{agentId}/settings")]
|
||||
public SettingsModel PutSettingsByAgent([FromRoute] string agentId)
|
||||
{
|
||||
string dataPath = Path.Combine(AppDomain.CurrentDomain.GetData("DataPath").ToString(), "Articulate", "settings.json");
|
||||
|
||||
string json = System.IO.File.ReadAllText(dataPath);
|
||||
|
||||
var settings = JsonConvert.DeserializeObject<SettingsModel>(json);
|
||||
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
using BotSharp.Core;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Platform.Articulate.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Platform.Articulate.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
public class TrainController : ControllerBase
|
||||
{
|
||||
private readonly IConfiguration configuration;
|
||||
private ArticulateAi<AgentModel> builder;
|
||||
|
||||
public TrainController(IConfiguration configuration)
|
||||
{
|
||||
builder = new ArticulateAi<AgentModel>();
|
||||
builder.PlatformConfig = configuration.GetSection("ArticulateAi");
|
||||
}
|
||||
|
||||
[HttpGet("/agent/{agentId}/train")]
|
||||
public async Task<AgentModel> TrainAgent([FromRoute] string agentId)
|
||||
{
|
||||
var agent = builder.GetAgentById(agentId);
|
||||
|
||||
var corpus = builder.ExtractorCorpus(agent);
|
||||
|
||||
await builder.Train(agent, corpus);
|
||||
|
||||
agent.Status = "Ready";
|
||||
|
||||
builder.SaveAgent(agent);
|
||||
|
||||
return agent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
using BotSharp.Platform.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Models
|
||||
{
|
||||
public class AgentModel : AgentBase
|
||||
{
|
||||
public AgentModel()
|
||||
{
|
||||
Domains = new List<DomainModel>();
|
||||
Entities = new List<EntityModel>();
|
||||
}
|
||||
|
||||
public string Status { get; set; }
|
||||
|
||||
public string Timezone { get; set; }
|
||||
|
||||
public string AgentName { get; set; }
|
||||
|
||||
public bool UseWebhook { get; set; }
|
||||
|
||||
public bool UsePostFormat { get; set; }
|
||||
|
||||
public bool ExtraTrainingData { get; set; }
|
||||
|
||||
public List<String> FallbackResponses { get; set; }
|
||||
|
||||
public bool EnableModelsPerDomain { get; set; }
|
||||
|
||||
public decimal DomainClassifierThreshold { get; set; }
|
||||
|
||||
public List<DomainModel> Domains { get; set; }
|
||||
|
||||
public List<EntityModel> Entities { get; set; }
|
||||
|
||||
public DateTime LastTraining { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
using BotSharp.Platform.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Models
|
||||
{
|
||||
public class DomainModel
|
||||
{
|
||||
public DomainModel()
|
||||
{
|
||||
Intents = new List<IntentModel>();
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
|
||||
public string Agent { get; set; }
|
||||
|
||||
public string DomainName { get; set; }
|
||||
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
public bool ExtraTrainingData { get; set; }
|
||||
|
||||
public decimal IntentThreshold { get; set; }
|
||||
|
||||
public string Status { get; set; }
|
||||
|
||||
public List<IntentModel> Intents { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
using BotSharp.Platform.Abstraction;
|
||||
using BotSharp.Platform.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Models
|
||||
{
|
||||
public class EntityModel : EntityBase
|
||||
{
|
||||
public string Regex { get; set; }
|
||||
|
||||
public string Agent { get; set; }
|
||||
|
||||
public string EntityName { get; set; }
|
||||
|
||||
public string Type { get; set; }
|
||||
|
||||
public string UiColor { get; set; }
|
||||
|
||||
public List<EntitySynonymModel> Examples { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Models
|
||||
{
|
||||
public class EntitySynonymModel
|
||||
{
|
||||
public string Value { get; set; }
|
||||
|
||||
public List<String> Synonyms { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
using BotSharp.Core.Engines;
|
||||
using BotSharp.Platform.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Models
|
||||
{
|
||||
public class IntentExampleModel
|
||||
{
|
||||
public string UserSays { get; set; }
|
||||
|
||||
public List<ArticulateTrainingIntentExpressionPart> Entities { get; set; }
|
||||
}
|
||||
|
||||
public class ArticulateTrainingIntentExpressionPart : TrainingIntentExpressionPart
|
||||
{
|
||||
public string EntityId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
using BotSharp.Platform.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Models
|
||||
{
|
||||
public class IntentModel : IntentBase
|
||||
{
|
||||
public string IntentName { get; set; }
|
||||
|
||||
public string Agent { get; set; }
|
||||
|
||||
public string Domain { get; set; }
|
||||
|
||||
public bool UsePostFormat { get; set; }
|
||||
|
||||
public bool UseWebhook { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User says
|
||||
/// </summary>
|
||||
public List<IntentExampleModel> Examples { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Intent responses
|
||||
/// </summary>
|
||||
public ScenarioModel Scenario { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Models
|
||||
{
|
||||
public class LanguageModel
|
||||
{
|
||||
public string Text { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Models
|
||||
{
|
||||
public class PipelineModel
|
||||
{
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Models
|
||||
{
|
||||
public class ScenarioModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Guid
|
||||
/// </summary>
|
||||
[StringLength(36)]
|
||||
public String Id { get; set; }
|
||||
|
||||
public string ScenarioName { get; set; }
|
||||
|
||||
public List<String> IntentResponses { get; set; }
|
||||
|
||||
public List<SlotModel> Slots { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Models
|
||||
{
|
||||
public class SettingsModel
|
||||
{
|
||||
public string DucklingURL { get; set; }
|
||||
|
||||
public string UiLanguage { get; set; }
|
||||
|
||||
public string DefaultAgentLanguage { get; set; }
|
||||
|
||||
public string DefaultTimezone { get; set; }
|
||||
|
||||
public List<String> Timezones { get; set; }
|
||||
|
||||
public List<PipelineModel> DomainClassifierPipeline { get; set; }
|
||||
|
||||
public List<PipelineModel> IntentClassifierPipeline { get; set; }
|
||||
|
||||
public List<String> DucklingDimension { get; set; }
|
||||
|
||||
public List<PipelineModel> EntityClassifierPipeline { get; set; }
|
||||
|
||||
public List<String> DefaultAgentFallbackResponses { get; set; }
|
||||
|
||||
public string RasaURL { get; set; }
|
||||
|
||||
public List<String> SpacyPretrainedEntities { get; set; }
|
||||
|
||||
public List<LanguageModel> AgentLanguages { get; set; }
|
||||
|
||||
public List<LanguageModel> UiLanguages { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Models
|
||||
{
|
||||
public class SlotModel
|
||||
{
|
||||
public string Entity { get; set; }
|
||||
|
||||
public bool IsList { get; set; }
|
||||
|
||||
public bool IsRequired { get; set; }
|
||||
|
||||
public string SlotName { get; set; }
|
||||
|
||||
public List<String> TextPrompts { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Configurations>Debug;Release;RASA;ARTICULATE</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ARTICULATE|AnyCPU'">
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<OutputPath></OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RASA|AnyCPU'">
|
||||
<Optimize>false</Optimize>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BotSharp.Core\BotSharp.Core.csproj" />
|
||||
<ProjectReference Include="..\BotSharp.Platform.Abstraction\BotSharp.Platform.Abstraction.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
using Platform.Articulate.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.ViewModels
|
||||
{
|
||||
public class DomainPageViewModel
|
||||
{
|
||||
public List<DomainModel> Domains { get; set; }
|
||||
|
||||
public int Total { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
using Platform.Articulate.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.ViewModels
|
||||
{
|
||||
public class EntityPageViewModel
|
||||
{
|
||||
public List<EntityModel> Entities { get; set; }
|
||||
|
||||
public int Total { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
using Platform.Articulate.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.ViewModels
|
||||
{
|
||||
public class IntentPageViewModel
|
||||
{
|
||||
public List<IntentViewModel> Intents { get; set; }
|
||||
|
||||
public int Total { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.Models
|
||||
{
|
||||
public class IntentScenarioViewModel : ScenarioModel
|
||||
{
|
||||
public string Domain { get; set; }
|
||||
|
||||
public string Agent { get; set; }
|
||||
|
||||
public string Intent { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
using BotSharp.Platform.Models;
|
||||
using Platform.Articulate.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.ViewModels
|
||||
{
|
||||
public class IntentViewModel : IntentBase
|
||||
{
|
||||
public string IntentName { get; set; }
|
||||
|
||||
public string Agent { get; set; }
|
||||
|
||||
public string Domain { get; set; }
|
||||
|
||||
public bool UsePostFormat { get; set; }
|
||||
|
||||
public bool UseWebhook { get; set; }
|
||||
|
||||
public List<IntentExampleModel> Examples { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Articulate.ViewModels
|
||||
{
|
||||
public class ResponseViewModel
|
||||
{
|
||||
public string TextResponse { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue