seperate platfrom extension
This commit is contained in:
parent
d656f4a75f
commit
979fbcfd7d
|
|
@ -80,7 +80,7 @@ If you feel that this project is helpful to you, please Star on the project, we
|
|||
<PackageReference Include="EntityFrameworkCore.BootKit" Version="1.9.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="2.1.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||
<PackageReference Include="RestSharp" Version="106.3.1" />
|
||||
<PackageReference Include="RestSharp" Version="106.4.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<DocumentationFile>C:\Users\haipi\Documents\Projects\BotSharp\BotSharp.RestApi\BotSharp.RestApi.xml</DocumentationFile>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
@ -85,13 +85,13 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\botsharp-dialogflow\BotSharp.Platform.Dialogflow\BotSharp.Platform.Dialogflow.csproj" />
|
||||
<ProjectReference Include="..\BotSharp.Core\BotSharp.Core.csproj" />
|
||||
<ProjectReference Include="..\BotSharp.Voice\BotSharp.Voice.csproj" />
|
||||
<ProjectReference Include="..\Platform.Articulate\Platform.Articulate.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -4,100 +4,6 @@
|
|||
<name>BotSharp.RestApi</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:BotSharp.RestApi.AgentController">
|
||||
<summary>
|
||||
Agent
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:BotSharp.RestApi.AgentController.#ctor(BotSharp.Core.Engines.IBotPlatform)">
|
||||
<summary>
|
||||
Initialize dialog controller and get a platform instance
|
||||
</summary>
|
||||
<param name="platform"></param>
|
||||
</member>
|
||||
<member name="M:BotSharp.RestApi.AgentController.Restore(Microsoft.AspNetCore.Http.IFormFile)">
|
||||
<summary>
|
||||
Restore a agent from a uploaded zip file
|
||||
</summary>
|
||||
<param name="file"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:BotSharp.RestApi.AgentController.Dump(System.String)">
|
||||
<summary>
|
||||
Dump agent
|
||||
</summary>
|
||||
<param name="agentId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:BotSharp.RestApi.Dialogflow.EntitiesController">
|
||||
<summary>
|
||||
The /entities endpoint is used to create, retrieve, update, and delete developer-defined entity objects.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:BotSharp.RestApi.Dialogflow.QueryController">
|
||||
<summary>
|
||||
Dialogflow mode query controller
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:BotSharp.RestApi.Dialogflow.QueryController.#ctor(BotSharp.Core.Engines.IBotPlatform)">
|
||||
<summary>
|
||||
Initialize dialog controller and get a platform instance
|
||||
</summary>
|
||||
<param name="platform"></param>
|
||||
</member>
|
||||
<member name="M:BotSharp.RestApi.Dialogflow.QueryController.Query(BotSharp.RestApi.Dialogflow.QueryModel)">
|
||||
<summary>
|
||||
The query endpoint is used to process natural language in the form of text.
|
||||
The query requests return structured data in JSON format with an action and parameters for that action.
|
||||
Both GET and POST methods return the same JSON response.
|
||||
</summary>
|
||||
<param name="request"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="P:BotSharp.RestApi.Dialogflow.QueryModel.Contexts">
|
||||
<summary>
|
||||
Array of additional context objects. Should be sent via a POST /query request.
|
||||
Contexts sent in a query are activated before the query.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:BotSharp.RestApi.Dialogflow.QueryModel.Event">
|
||||
<summary>
|
||||
Object containing event name and additional data.
|
||||
The "data" parameter can be submitted only in POST requests.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:BotSharp.RestApi.Dialogflow.QueryModel.Lang">
|
||||
<summary>
|
||||
Language tag, e.g., en, es etc.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:BotSharp.RestApi.Dialogflow.QueryModel.Query">
|
||||
<summary>
|
||||
Natural language text to be processed. Query length should not exceed 256 characters.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:BotSharp.RestApi.Dialogflow.QueryModel.SessionId">
|
||||
<summary>
|
||||
A string token up to 36 symbols long, used to identify the client and to manage session parameters (including contexts) per client.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:BotSharp.RestApi.Dialogflow.QueryModel.Timezone">
|
||||
<summary>
|
||||
Time zone from IANA Time Zone Database Examples: America/New_York, Europe/Paris
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:BotSharp.RestApi.Rasa.TrainController">
|
||||
<summary>
|
||||
You can post your training data to this endpoint to train a new model for a project.
|
||||
This request will wait for the server answer: either the model was trained successfully or the training exited with an error.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:BotSharp.RestApi.Rasa.TrainController.#ctor(BotSharp.Core.Engines.IBotPlatform)">
|
||||
<summary>
|
||||
Initialize dialog controller and get a platform instance
|
||||
</summary>
|
||||
<param name="platform"></param>
|
||||
</member>
|
||||
<member name="P:BotSharp.RestApi.Integrations.FacebookMessenger.WebhookMessageRecipient.Id">
|
||||
<summary>
|
||||
PAGE_ID
|
||||
|
|
|
|||
|
|
@ -65,13 +65,11 @@
|
|||
<ItemGroup>
|
||||
<ProjectReference Include="..\BotSharp.Core\BotSharp.Core.csproj" />
|
||||
<ProjectReference Include="..\BotSharp.RestApi\BotSharp.RestApi.csproj" />
|
||||
<ProjectReference Include="..\Platform.Articulate\Platform.Articulate.csproj" />
|
||||
<ProjectReference Include="..\Platform.Dialogflow\Platform.Dialogflow.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.2" />
|
||||
<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" />
|
||||
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="3.0.0" />
|
||||
|
|
|
|||
178
BotSharp.sln
178
BotSharp.sln
|
|
@ -29,264 +29,104 @@ 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}") = "Platform.Articulate", "Platform.Articulate\Platform.Articulate.csproj", "{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Platform.Dialogflow", "Platform.Dialogflow\Platform.Dialogflow.csproj", "{25503190-0B4B-4ECA-8C0C-D12A53A09583}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Dialogflow", "..\botsharp-dialogflow\BotSharp.Platform.Dialogflow\BotSharp.Platform.Dialogflow.csproj", "{B865F070-9693-47C6-B901-40121F659C6F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
ARTICULATE|Any CPU = ARTICULATE|Any CPU
|
||||
ARTICULATE|x64 = ARTICULATE|x64
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
DIALOGFLOW|Any CPU = DIALOGFLOW|Any CPU
|
||||
DIALOGFLOW|x64 = DIALOGFLOW|x64
|
||||
RASA|Any CPU = RASA|Any CPU
|
||||
RASA|x64 = RASA|x64
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{95780673-2A1A-4953-962F-C46CBFDD07FF}.ARTICULATE|Any CPU.ActiveCfg = ARTICULATE|Any CPU
|
||||
{95780673-2A1A-4953-962F-C46CBFDD07FF}.ARTICULATE|Any CPU.Build.0 = ARTICULATE|Any CPU
|
||||
{95780673-2A1A-4953-962F-C46CBFDD07FF}.ARTICULATE|x64.ActiveCfg = ARTICULATE|x64
|
||||
{95780673-2A1A-4953-962F-C46CBFDD07FF}.ARTICULATE|x64.Build.0 = ARTICULATE|x64
|
||||
{95780673-2A1A-4953-962F-C46CBFDD07FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{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}.RASA|Any CPU.ActiveCfg = RASA|Any CPU
|
||||
{95780673-2A1A-4953-962F-C46CBFDD07FF}.RASA|Any CPU.Build.0 = RASA|Any CPU
|
||||
{95780673-2A1A-4953-962F-C46CBFDD07FF}.RASA|x64.ActiveCfg = RASA|x64
|
||||
{95780673-2A1A-4953-962F-C46CBFDD07FF}.RASA|x64.Build.0 = RASA|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
|
||||
{95780673-2A1A-4953-962F-C46CBFDD07FF}.Release|x64.Build.0 = Release|x64
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.ARTICULATE|Any CPU.ActiveCfg = ARTICULATE|Any CPU
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.ARTICULATE|Any CPU.Build.0 = ARTICULATE|Any CPU
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.ARTICULATE|x64.ActiveCfg = ARTICULATE|x64
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.ARTICULATE|x64.Build.0 = ARTICULATE|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}.DIALOGFLOW|Any CPU.ActiveCfg = DIALOGFLOW|Any CPU
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|x64
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|x64
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.RASA|Any CPU.ActiveCfg = RASA|Any CPU
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.RASA|Any CPU.Build.0 = RASA|Any CPU
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.RASA|x64.ActiveCfg = RASA|x64
|
||||
{80DDAA05-69BC-49DD-96A4-37345E7A2E20}.RASA|x64.Build.0 = RASA|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}.ARTICULATE|Any CPU.ActiveCfg = ARTICULATE|Any CPU
|
||||
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.ARTICULATE|Any CPU.Build.0 = ARTICULATE|Any CPU
|
||||
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.ARTICULATE|x64.ActiveCfg = ARTICULATE|x64
|
||||
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.ARTICULATE|x64.Build.0 = ARTICULATE|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
|
||||
{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}.RASA|Any CPU.ActiveCfg = RASA|Any CPU
|
||||
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.RASA|Any CPU.Build.0 = RASA|Any CPU
|
||||
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.RASA|x64.ActiveCfg = RASA|x64
|
||||
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.RASA|x64.Build.0 = RASA|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
|
||||
{03DCA427-327A-4FC9-9A2F-57D17F16708C}.Release|x64.Build.0 = Release|x64
|
||||
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.ARTICULATE|Any CPU.ActiveCfg = ARTICULATE|Any CPU
|
||||
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.ARTICULATE|Any CPU.Build.0 = ARTICULATE|Any CPU
|
||||
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.ARTICULATE|x64.ActiveCfg = ARTICULATE|x64
|
||||
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.ARTICULATE|x64.Build.0 = ARTICULATE|x64
|
||||
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{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}.RASA|Any CPU.ActiveCfg = RASA|Any CPU
|
||||
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.RASA|Any CPU.Build.0 = RASA|Any CPU
|
||||
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.RASA|x64.ActiveCfg = RASA|x64
|
||||
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.RASA|x64.Build.0 = RASA|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
|
||||
{C2FDC855-BD88-4041-B0FF-3AA8A1C11A22}.Release|x64.Build.0 = Release|x64
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.ARTICULATE|Any CPU.ActiveCfg = ARTICULATE|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.ARTICULATE|Any CPU.Build.0 = ARTICULATE|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.ARTICULATE|x64.ActiveCfg = ARTICULATE|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.ARTICULATE|x64.Build.0 = ARTICULATE|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.DIALOGFLOW|Any CPU.ActiveCfg = DIALOGFLOW|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.DIALOGFLOW|x64.ActiveCfg = DIALOGFLOW|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.DIALOGFLOW|x64.Build.0 = DIALOGFLOW|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.RASA|Any CPU.ActiveCfg = RASA|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.RASA|Any CPU.Build.0 = RASA|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.RASA|x64.ActiveCfg = RASA|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.RASA|x64.Build.0 = RASA|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{184F8B93-68C2-4849-9625-4023C4360990}.Release|x64.Build.0 = Release|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.ARTICULATE|Any CPU.ActiveCfg = ARTICULATE|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.ARTICULATE|Any CPU.Build.0 = ARTICULATE|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.ARTICULATE|x64.ActiveCfg = ARTICULATE|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.ARTICULATE|x64.Build.0 = ARTICULATE|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.DIALOGFLOW|Any CPU.ActiveCfg = DIALOGFLOW|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.DIALOGFLOW|Any CPU.Build.0 = DIALOGFLOW|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.DIALOGFLOW|x64.ActiveCfg = Debug|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.DIALOGFLOW|x64.Build.0 = Debug|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.RASA|Any CPU.ActiveCfg = RASA|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.RASA|Any CPU.Build.0 = RASA|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.RASA|x64.ActiveCfg = Release|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.RASA|x64.Build.0 = Release|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{3F0CAAD4-564B-43FF-90BF-26AC47C9D677}.Release|x64.Build.0 = Release|Any CPU
|
||||
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.ARTICULATE|Any CPU.ActiveCfg = ARTICULATE|Any CPU
|
||||
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.ARTICULATE|Any CPU.Build.0 = ARTICULATE|Any CPU
|
||||
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.ARTICULATE|x64.ActiveCfg = ARTICULATE|x64
|
||||
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.ARTICULATE|x64.Build.0 = ARTICULATE|x64
|
||||
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{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}.RASA|Any CPU.ActiveCfg = RASA|Any CPU
|
||||
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.RASA|Any CPU.Build.0 = RASA|Any CPU
|
||||
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.RASA|x64.ActiveCfg = RASA|x64
|
||||
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.RASA|x64.Build.0 = RASA|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
|
||||
{8A1F6277-FFCB-4CCD-B798-876D8BE525A9}.Release|x64.Build.0 = Release|x64
|
||||
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.ARTICULATE|Any CPU.ActiveCfg = ARTICULATE|Any CPU
|
||||
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.ARTICULATE|Any CPU.Build.0 = ARTICULATE|Any CPU
|
||||
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.ARTICULATE|x64.ActiveCfg = ARTICULATE|x64
|
||||
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.ARTICULATE|x64.Build.0 = ARTICULATE|x64
|
||||
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{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}.RASA|Any CPU.ActiveCfg = RASA|Any CPU
|
||||
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.RASA|Any CPU.Build.0 = RASA|Any CPU
|
||||
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.RASA|x64.ActiveCfg = RASA|x64
|
||||
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.RASA|x64.Build.0 = RASA|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
|
||||
{30F80E7D-951A-4E8F-9C3C-2C866528EABD}.Release|x64.Build.0 = Release|x64
|
||||
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.ARTICULATE|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.ARTICULATE|Any CPU.Build.0 = Debug|Any CPU
|
||||
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.ARTICULATE|x64.ActiveCfg = Debug|Any CPU
|
||||
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.ARTICULATE|x64.Build.0 = Debug|Any CPU
|
||||
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{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}.RASA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.RASA|Any CPU.Build.0 = Release|Any CPU
|
||||
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.RASA|x64.ActiveCfg = Release|Any CPU
|
||||
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.RASA|x64.Build.0 = Release|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
|
||||
{62F08F9F-16C2-4754-90B0-B604DC18AE23}.Release|x64.Build.0 = Release|Any CPU
|
||||
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.ARTICULATE|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.ARTICULATE|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.ARTICULATE|x64.ActiveCfg = Debug|Any CPU
|
||||
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.ARTICULATE|x64.Build.0 = Debug|Any CPU
|
||||
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{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}.RASA|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.RASA|Any CPU.Build.0 = Release|Any CPU
|
||||
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.RASA|x64.ActiveCfg = Release|Any CPU
|
||||
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.RASA|x64.Build.0 = Release|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
|
||||
{C4F2EAE5-F2C7-4F52-9DB2-7E76D7080C72}.Release|x64.Build.0 = Release|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.ARTICULATE|Any CPU.ActiveCfg = ARTICULATE|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.ARTICULATE|Any CPU.Build.0 = ARTICULATE|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.ARTICULATE|x64.ActiveCfg = Debug|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.ARTICULATE|x64.Build.0 = Debug|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.DIALOGFLOW|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.DIALOGFLOW|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.DIALOGFLOW|x64.ActiveCfg = Debug|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.DIALOGFLOW|x64.Build.0 = Debug|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.RASA|Any CPU.ActiveCfg = RASA|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.RASA|Any CPU.Build.0 = RASA|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.RASA|x64.ActiveCfg = Release|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.RASA|x64.Build.0 = Release|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{2B279A6C-C829-4D29-9C1C-809C8A8E36B2}.Release|x64.Build.0 = Release|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.ARTICULATE|Any CPU.ActiveCfg = ARTICULATE|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.ARTICULATE|Any CPU.Build.0 = ARTICULATE|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.ARTICULATE|x64.ActiveCfg = Debug|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.ARTICULATE|x64.Build.0 = Debug|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.DIALOGFLOW|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.DIALOGFLOW|Any CPU.Build.0 = Debug|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.DIALOGFLOW|x64.ActiveCfg = Debug|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.DIALOGFLOW|x64.Build.0 = Debug|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.RASA|Any CPU.ActiveCfg = RASA|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.RASA|Any CPU.Build.0 = RASA|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.RASA|x64.ActiveCfg = Release|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.RASA|x64.Build.0 = Release|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{25503190-0B4B-4ECA-8C0C-D12A53A09583}.Release|x64.Build.0 = Release|Any CPU
|
||||
{B865F070-9693-47C6-B901-40121F659C6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B865F070-9693-47C6-B901-40121F659C6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B865F070-9693-47C6-B901-40121F659C6F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{B865F070-9693-47C6-B901-40121F659C6F}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{B865F070-9693-47C6-B901-40121F659C6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{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
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
|||
|
|
@ -1,293 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BotSharp.Platform.Abstraction;
|
||||
using BotSharp.Platform.Models;
|
||||
using BotSharp.Platform.Models.AiResponse;
|
||||
using BotSharp.Platform.Models.Intents;
|
||||
using BotSharp.Platform.Models.MachineLearning;
|
||||
using DotNetToolkit;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Platform.Dialogflow.Models;
|
||||
|
||||
namespace Platform.Dialogflow
|
||||
{
|
||||
/// <summary>
|
||||
/// Import agent from Dialogflow
|
||||
/// </summary>
|
||||
public class AgentImporterInDialogflow<TAgent> : IAgentImporter<TAgent> where TAgent : AgentModel
|
||||
{
|
||||
public string AgentDir { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Load agent meta
|
||||
/// </summary>
|
||||
/// <param name="agentName"></param>
|
||||
/// <param name="agentDir"></param>
|
||||
/// <returns></returns>
|
||||
public TAgent LoadAgent(AgentImportHeader agentHeader)
|
||||
{
|
||||
// load agent profile
|
||||
string data = File.ReadAllText(Path.Combine(AgentDir, "agent.json"));
|
||||
var agent = JsonConvert.DeserializeObject<DialogflowAgentImportModel>(data);
|
||||
agent.Name = agentHeader.Name;
|
||||
agent.Id = agentHeader.Id;
|
||||
|
||||
var result = agent.ToObject<TAgent>();
|
||||
result.ClientAccessToken = agentHeader.ClientAccessToken;
|
||||
result.DeveloperAccessToken = agentHeader.DeveloperAccessToken;
|
||||
|
||||
result.MlConfig = agent.ToObject<AgentMlConfig>();
|
||||
result.MlConfig.MinConfidence = agent.MlMinConfidence;
|
||||
result.MlConfig.AgentId = agent.Id;
|
||||
if(agentHeader.Integrations != null)
|
||||
{
|
||||
agentHeader.Integrations.ForEach(x => x.AgentId = agent.Id);
|
||||
result.Integrations = agentHeader.Integrations;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void LoadCustomEntities(TAgent agent)
|
||||
{
|
||||
agent.Entities = new List<EntityType>();
|
||||
string entityDir = Path.Combine(AgentDir, "entities");
|
||||
if (!Directory.Exists(entityDir)) return;
|
||||
|
||||
Directory.EnumerateFiles(entityDir)
|
||||
.ToList()
|
||||
.ForEach(fileName =>
|
||||
{
|
||||
string entityName = fileName.Split(Path.DirectorySeparatorChar).Last();
|
||||
if (!entityName.Contains("_"))
|
||||
{
|
||||
string entityJson = File.ReadAllText($"{fileName}");
|
||||
var entity = JsonConvert.DeserializeObject<DialogflowEntity>(entityJson);
|
||||
|
||||
// load entries
|
||||
string entriesFileName = fileName.Replace(entity.Name, $"{entity.Name}_entries_{agent.Language}");
|
||||
if (File.Exists(entriesFileName))
|
||||
{
|
||||
string entriesJson = File.ReadAllText($"{entriesFileName}");
|
||||
entriesJson = entriesJson.Replace("\"synonyms\":", "\"rawSynonyms\":");
|
||||
entity.Entries = JsonConvert.DeserializeObject<List<DialogflowEntityEntry>>(entriesJson);
|
||||
entity.Entries.ForEach(x => x.Synonyms = x.RawSynonyms.Select(s => new EntrySynonym
|
||||
{
|
||||
Synonym = s
|
||||
}).ToList());
|
||||
}
|
||||
|
||||
var entityType = entity.ToObject<EntityType>();
|
||||
agent.Entities.Add(entityType);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void LoadIntents(TAgent agent)
|
||||
{
|
||||
agent.Intents = new List<Intent>();
|
||||
string intentDir = Path.Combine(AgentDir, "intents");
|
||||
if (!Directory.Exists(intentDir)) return;
|
||||
|
||||
Directory.EnumerateFiles(intentDir)
|
||||
.ToList()
|
||||
.ForEach(fileName =>
|
||||
{
|
||||
if (!fileName.Contains("_usersays_" + agent.Language)
|
||||
|| fileName.Contains("Default Fallback Intent"))
|
||||
{
|
||||
string intentJson = File.ReadAllText($"{fileName}");
|
||||
|
||||
// avoid confict data structure
|
||||
intentJson = intentJson.Replace("\"contexts\":", "\"contextList\":");
|
||||
intentJson = intentJson.Replace("\"messages\":", "\"messageList\":");
|
||||
intentJson = intentJson.Replace("\"prompts\":", "\"promptList\":");
|
||||
|
||||
var intent = JsonConvert.DeserializeObject<DialogflowIntent>(intentJson);
|
||||
var newIntent = ImportIntentUserSays(agent, intent, fileName);
|
||||
agent.Intents.Add(newIntent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Intent ImportIntentUserSays(TAgent agent, DialogflowIntent intent, string fileName)
|
||||
{
|
||||
// void id confict
|
||||
intent.Id = Guid.NewGuid().ToString();
|
||||
intent.Name = intent.Name.Replace("/", "_");
|
||||
// load user expressions
|
||||
if (fileName.Contains("Default Fallback Intent"))
|
||||
{
|
||||
intent.UserSays = (intent.Responses[0].MessageList[0].Speech as JArray)
|
||||
.Select(x => new DialogflowIntentExpression
|
||||
{
|
||||
Data = new List<DialogflowIntentExpressionPart>
|
||||
{
|
||||
new DialogflowIntentExpressionPart
|
||||
{
|
||||
Text = x.ToString()
|
||||
}
|
||||
}
|
||||
}).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
string expressionFileName = fileName.Replace(intent.Name, $"{intent.Name}_usersays_{agent.Language}");
|
||||
if (File.Exists(expressionFileName))
|
||||
{
|
||||
string expressionJson = File.ReadAllText($"{expressionFileName}");
|
||||
intent.UserSays = JsonConvert.DeserializeObject<List<DialogflowIntentExpression>>(expressionJson);
|
||||
|
||||
intent.UserSays.ForEach(say =>
|
||||
{
|
||||
// remove @sys.ignore
|
||||
say.Data.Where(x => x.Meta == "@sys.ignore").ToList().ForEach(x => x.Meta = null);
|
||||
|
||||
// remove @sys.
|
||||
say.Data.Where(x => x.Meta != null && x.Meta.StartsWith("@sys.")).ToList().ForEach(x => x.Meta = x.Meta.Substring(5));
|
||||
|
||||
// remove @
|
||||
say.Data.Where(x => x.Meta != null && x.Meta.StartsWith("@")).ToList().ForEach(x => x.Meta = x.Meta.Substring(1));
|
||||
|
||||
// calculate offset
|
||||
for(int i = 1; i < say.Data.Count; i++)
|
||||
{
|
||||
say.Data[i].Start = String.Join("", say.Data.Select(x => x.Text).Take(i)).Length;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var newIntent = ImportIntentResponse(agent, intent);
|
||||
|
||||
newIntent.Contexts = intent.ContextList.Select(x => new IntentInputContext { Name = x }).ToList();
|
||||
|
||||
return newIntent;
|
||||
}
|
||||
|
||||
private Intent ImportIntentResponse(TAgent agent, DialogflowIntent intent)
|
||||
{
|
||||
var newIntent = intent.ToObject<Intent>();
|
||||
|
||||
intent.Responses.ForEach(res =>
|
||||
{
|
||||
var newResponse = newIntent.Responses.First(x => x.Id == res.Id);
|
||||
|
||||
newResponse.Contexts = res.AffectedContexts.Select(x => new IntentResponseContext
|
||||
{
|
||||
Name = x.Name,
|
||||
Lifespan = x.Lifespan
|
||||
}).ToList();
|
||||
|
||||
int millSeconds = 0;
|
||||
|
||||
newResponse.Messages = res.MessageList.Where(x => x.Speech != null || x.Payload != null)
|
||||
.Select(x =>
|
||||
{
|
||||
if (x.Type == AIResponseMessageType.Custom)
|
||||
{
|
||||
return new IntentResponseMessage
|
||||
{
|
||||
Payload = JObject.FromObject(x.Payload),
|
||||
PayloadJson = JsonConvert.SerializeObject(x.Payload),
|
||||
Type = x.Type,
|
||||
UpdatedTime = DateTime.UtcNow.AddMilliseconds(millSeconds++)
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
var speech = JsonConvert.SerializeObject(x.Speech.GetType().Equals(typeof(String)) ?
|
||||
new List<String> { x.Speech.ToString() } :
|
||||
(x.Speech as JArray).Select(s => s.Value<String>()).ToList());
|
||||
|
||||
return new IntentResponseMessage
|
||||
{
|
||||
Speech = speech,
|
||||
Type = x.Type,
|
||||
UpdatedTime = DateTime.UtcNow.AddMilliseconds(millSeconds++)
|
||||
};
|
||||
}
|
||||
|
||||
}).ToList();
|
||||
|
||||
newResponse.Parameters = res.Parameters.Select(p =>
|
||||
{
|
||||
var rp = p.ToObject<IntentResponseParameter>();
|
||||
|
||||
// remove @sys.
|
||||
if (rp.DataType.StartsWith("@sys."))
|
||||
{
|
||||
rp.DataType = rp.DataType.Substring(5);
|
||||
}
|
||||
|
||||
if (rp.DataType.StartsWith("@"))
|
||||
{
|
||||
rp.DataType = rp.DataType.Substring(1);
|
||||
}
|
||||
|
||||
rp.Prompts = p.PromptList.Select(pl => new ResponseParameterPrompt { Prompt = pl.Value }).ToList();
|
||||
return rp;
|
||||
}).ToList();
|
||||
});
|
||||
|
||||
return newIntent;
|
||||
}
|
||||
|
||||
public void LoadBuildinEntities(TAgent agent)
|
||||
{
|
||||
agent.Intents.ForEach(intent =>
|
||||
{
|
||||
if (intent.UserSays != null)
|
||||
{
|
||||
intent.UserSays.ForEach(us =>
|
||||
{
|
||||
us.Data.Where(data => data.Meta != null)
|
||||
.ToList()
|
||||
.ForEach(data =>
|
||||
{
|
||||
LoadBuildinEntityTypePerUserSay(agent, data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void LoadBuildinEntityTypePerUserSay(TAgent agent, IntentExpressionPart data)
|
||||
{
|
||||
var existedEntityType = agent.Entities.FirstOrDefault(x => x.Name == data.Meta);
|
||||
|
||||
if (existedEntityType == null)
|
||||
{
|
||||
existedEntityType = new EntityType
|
||||
{
|
||||
Name = data.Meta,
|
||||
Entries = new List<EntityEntry>(),
|
||||
IsOverridable = true
|
||||
};
|
||||
|
||||
agent.Entities.Add(existedEntityType);
|
||||
}
|
||||
|
||||
var entries = existedEntityType.Entries.Select(x => x.Value.ToLower()).ToList();
|
||||
if (!entries.Contains(data.Text.ToLower()))
|
||||
{
|
||||
existedEntityType.Entries.Add(new EntityEntry
|
||||
{
|
||||
Value = data.Text,
|
||||
Synonyms = new List<EntrySynonym>
|
||||
{
|
||||
new EntrySynonym
|
||||
{
|
||||
Synonym = data.Text
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
using BotSharp.Core.Engines;
|
||||
using DotNetToolkit;
|
||||
using EntityFrameworkCore.BootKit;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using Platform.Dialogflow.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Platform.Dialogflow.Controllers
|
||||
{
|
||||
#if DIALOGFLOW
|
||||
/// <summary>
|
||||
/// Agent
|
||||
/// </summary>
|
||||
[Route("v1/[controller]")]
|
||||
public class AgentController : ControllerBase
|
||||
{
|
||||
private DialogflowAi<AgentModel> builder;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize dialog controller and get a platform instance
|
||||
/// </summary>
|
||||
/// <param name="platform"></param>
|
||||
public AgentController(IConfiguration configuration)
|
||||
{
|
||||
builder = new DialogflowAi<AgentModel>();
|
||||
builder.PlatformConfig = configuration.GetSection("DialogflowAi");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Import a agent from a uploaded zip file
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("import")]
|
||||
public async Task<ActionResult> Import(IFormFile uploadedFile)
|
||||
{
|
||||
if (uploadedFile == null || uploadedFile.Length == 0)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
var filePath = Path.GetTempFileName();
|
||||
Console.WriteLine($"Temp file saved to {filePath}");
|
||||
|
||||
using (var stream = new FileStream(filePath, FileMode.Create))
|
||||
{
|
||||
await uploadedFile.CopyToAsync(stream);
|
||||
}
|
||||
|
||||
string dest = Path.Combine(AppDomain.CurrentDomain.GetData("DataPath").ToString(), "Projects", uploadedFile.FileName.Split('.').First(), "tmp");
|
||||
if (Directory.Exists(dest))
|
||||
{
|
||||
System.IO.Directory.Delete(dest, true);
|
||||
}
|
||||
|
||||
Console.WriteLine($"Extract zip file to {dest}");
|
||||
ZipFile.ExtractToDirectory(filePath, dest);
|
||||
|
||||
System.IO.File.Delete(filePath);
|
||||
|
||||
Console.WriteLine($"Loading agent from folder {dest}");
|
||||
var agent = builder.LoadAgentFromFile<AgentImporterInDialogflow<AgentModel>>(dest);
|
||||
builder.SaveAgent(agent);
|
||||
|
||||
return Ok(agent.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dump agent
|
||||
/// </summary>
|
||||
/// <param name="agentId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{agentId}")]
|
||||
public ActionResult Dump([FromRoute] String agentId)
|
||||
{
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Platform.Dialogflow.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Controllers
|
||||
{
|
||||
#if DIALOGFLOW
|
||||
/// <summary>
|
||||
/// The /entities endpoint is used to create, retrieve, update, and delete developer-defined entity objects.
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("v1/[controller]")]
|
||||
public class EntitiesController : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public IEnumerable<DialogflowAllEntityViewModel> All()
|
||||
{
|
||||
return new List<DialogflowAllEntityViewModel>();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Platform.Dialogflow.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Controllers
|
||||
{
|
||||
#if DIALOGFLOW
|
||||
/// <summary>
|
||||
/// The /intents endpoint is used to create, retrieve, update, and delete intent objects.
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("v1/[controller]")]
|
||||
public class IntentsController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves a list of all intents for the agent.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public IEnumerable<DialogflowIntent> GetIntents()
|
||||
{
|
||||
return new List<DialogflowIntent>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The POST request creates a new intent. When a new intent is created via the API, the agent is trained with the new data.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public string PostIntent([FromBody] DialogflowIntent intent)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the specified intent. {id} is the ID of the intent to retrieve.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}")]
|
||||
public DialogflowIntent GetIntent()
|
||||
{
|
||||
return new DialogflowIntent();
|
||||
}
|
||||
|
||||
[HttpPut("{id}")]
|
||||
public bool PutIntent([FromBody] DialogflowIntent intent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
using BotSharp.Core.Engines;
|
||||
using BotSharp.NLP;
|
||||
using BotSharp.Platform.Models;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Platform.Dialogflow.Models;
|
||||
using Platform.Dialogflow.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Controllers
|
||||
{
|
||||
#if DIALOGFLOW
|
||||
/// <summary>
|
||||
/// Dialogflow mode query controller
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("v1/[controller]")]
|
||||
public class QueryController : ControllerBase
|
||||
{
|
||||
private readonly IBotPlatform _platform;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize dialog controller and get a platform instance
|
||||
/// </summary>
|
||||
/// <param name="platform"></param>
|
||||
public QueryController(IBotPlatform platform)
|
||||
{
|
||||
_platform = platform;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The query endpoint is used to process natural language in the form of text.
|
||||
/// The query requests return structured data in JSON format with an action and parameters for that action.
|
||||
/// Both GET and POST methods return the same JSON response.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet, HttpPost]
|
||||
public ActionResult<AIResponse> Query(QueryModel request)
|
||||
{
|
||||
String clientAccessToken = (User.Identity as ClaimsIdentity).Claims.FirstOrDefault(x => x.Type == "UserId")?.Value;
|
||||
//_platform.AiConfig = new AIConfiguration(clientAccessToken, SupportedLanguage.English);
|
||||
//_platform.AiConfig.SessionId = request.SessionId;
|
||||
|
||||
// find a model according to clientAccessToken
|
||||
string projectPath = String.Empty;
|
||||
string projectsPath = Path.Combine(AppDomain.CurrentDomain.GetData("DataPath").ToString(), "Projects");
|
||||
|
||||
string[] d1 = Directory.GetDirectories(projectsPath);
|
||||
for (int i = 0; i < d1.Length; i++)
|
||||
{
|
||||
string[] d2 = Directory.GetDirectories(d1[i]);
|
||||
for (int j = 0; j < d2.Length; j++)
|
||||
{
|
||||
string metaJson = System.IO.File.ReadAllText(Path.Combine(d2[j], "meta.json"));
|
||||
|
||||
var meta = JsonConvert.DeserializeObject<AgentImportHeader>(metaJson);
|
||||
|
||||
if (meta.ClientAccessToken == clientAccessToken)
|
||||
{
|
||||
projectPath = d1[i];
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
if (!String.IsNullOrEmpty(projectPath))
|
||||
{
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// Load agent
|
||||
string model = Directory.GetDirectories(projectPath).Where(x => x.Contains("model_")).Last().Split(Path.DirectorySeparatorChar).Last();
|
||||
string dataDir = Path.Combine(projectPath, model);
|
||||
|
||||
if(!System.IO.File.Exists(Path.Combine(dataDir, "model-meta.json")))
|
||||
{
|
||||
return BadRequest("The agent hasn't been trained. Please train the agent before querying.");
|
||||
}
|
||||
|
||||
Console.WriteLine($"LoadAgentFromFile {dataDir}");
|
||||
|
||||
//_platform.LoadAgentFromFile(dataDir);
|
||||
|
||||
/*var aIResponse = _platform.TextRequest(new AIRequest
|
||||
{
|
||||
Timezone = request.Timezone,
|
||||
Contexts = request?.Contexts?.Select(x => new AIContext { Name = x })?.ToList(),
|
||||
Language = request.Lang,
|
||||
Query = new String[] { request.Query },
|
||||
AgentDir = projectPath,
|
||||
Model = model
|
||||
});*/
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
using BotSharp.Core.Engines;
|
||||
using BotSharp.Platform.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Platform.Dialogflow.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Platform.Dialogflow.Controllers
|
||||
{
|
||||
#if DIALOGFLOW
|
||||
/// <summary>
|
||||
/// You can post your training data to this endpoint to train a new model for a project.
|
||||
/// This request will wait for the server answer: either the model was trained successfully or the training exited with an error.
|
||||
/// </summary>
|
||||
[Route("v1/[controller]")]
|
||||
public class TrainController : ControllerBase
|
||||
{
|
||||
private DialogflowAi<AgentModel> builder;
|
||||
|
||||
public TrainController(IConfiguration configuration)
|
||||
{
|
||||
builder = new DialogflowAi<AgentModel>();
|
||||
builder.PlatformConfig = configuration.GetSection("DialogflowAi");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<AgentModel>> Train([FromQuery] string agentId)
|
||||
{
|
||||
var agent = builder.GetAgentById(agentId);
|
||||
|
||||
if(agent == null)
|
||||
{
|
||||
agent = builder.GetAgentByName(agentId);
|
||||
}
|
||||
|
||||
var corpus = builder.ExtractorCorpus(agent);
|
||||
|
||||
await builder.Train(agent, corpus);
|
||||
|
||||
return agent;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1,165 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BotSharp.Core;
|
||||
using BotSharp.Core.Engines;
|
||||
using BotSharp.NLP;
|
||||
using BotSharp.Platform.Abstraction;
|
||||
using BotSharp.Platform.Models;
|
||||
using BotSharp.Platform.Models.AiRequest;
|
||||
using BotSharp.Platform.Models.AiResponse;
|
||||
using DotNetToolkit;
|
||||
using Platform.Dialogflow.Models;
|
||||
|
||||
namespace Platform.Dialogflow
|
||||
{
|
||||
public class DialogflowAi<TAgent> :
|
||||
PlatformBuilderBase<TAgent>,
|
||||
IPlatformBuilder<TAgent>
|
||||
where TAgent : AgentModel
|
||||
{
|
||||
public TrainingCorpus ExtractorCorpus(TAgent agent)
|
||||
{
|
||||
var corpus = new TrainingCorpus
|
||||
{
|
||||
Entities = new List<TrainingEntity>(),
|
||||
UserSays = new List<TrainingIntentExpression<TrainingIntentExpressionPart>>()
|
||||
};
|
||||
|
||||
agent.Entities.ForEach(entity =>
|
||||
{
|
||||
corpus.Entities.Add(new TrainingEntity
|
||||
{
|
||||
Entity = entity.Name,
|
||||
Values = entity.Entries.Select(x => new TrainingEntitySynonym
|
||||
{
|
||||
Value = x.Value,
|
||||
Synonyms = x.Synonyms.Select(y => y.Synonym).ToList()
|
||||
}).ToList()
|
||||
});
|
||||
});
|
||||
|
||||
agent.Intents.ForEach(intent =>
|
||||
{
|
||||
intent.UserSays.ForEach(say => {
|
||||
corpus.UserSays.Add(new TrainingIntentExpression<TrainingIntentExpressionPart>
|
||||
{
|
||||
Intent = intent.Name,
|
||||
Text = String.Join("", say.Data.Select(x => x.Text)),
|
||||
Entities = say.Data.Where(x => !String.IsNullOrEmpty(x.Meta))
|
||||
.Select(x => new TrainingIntentExpressionPart
|
||||
{
|
||||
Value = x.Text,
|
||||
Entity = x.Meta,
|
||||
Start = x.Start
|
||||
})
|
||||
.ToList()
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return corpus;
|
||||
}
|
||||
|
||||
public AiResponse TextRequest(AiRequest request)
|
||||
{
|
||||
var dataService = new AIDataService(new AIConfiguration("TOKEN", SupportedLanguage.English)
|
||||
{
|
||||
AgentId = request.AgentId,
|
||||
Language = SupportedLanguage.English,
|
||||
SessionId = request.SessionId
|
||||
});
|
||||
|
||||
var response = dataService.Request(new AIRequest
|
||||
{
|
||||
SessionId = request.SessionId,
|
||||
Query = new string[] { request.Text }
|
||||
});
|
||||
|
||||
return response.ToObject<AiResponse>();
|
||||
}
|
||||
|
||||
public async Task<bool> Train(TAgent agent, TrainingCorpus corpus)
|
||||
{
|
||||
var trainer = new BotTrainer();
|
||||
|
||||
var trainOptions = new BotTrainOptions
|
||||
{
|
||||
//AgentDir = projectPath,
|
||||
//Model = model
|
||||
};
|
||||
|
||||
var info = await trainer.Train(agent, trainOptions);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected float[] TrimSilence(float[] samples)
|
||||
{
|
||||
if (samples == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
const float min = 0.000001f;
|
||||
|
||||
var startIndex = 0;
|
||||
var endIndex = samples.Length;
|
||||
|
||||
for (var i = 0; i < samples.Length; i++)
|
||||
{
|
||||
|
||||
if (Math.Abs(samples[i]) > min)
|
||||
{
|
||||
startIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = samples.Length - 1; i > 0; i--)
|
||||
{
|
||||
if (Math.Abs(samples[i]) > min)
|
||||
{
|
||||
endIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (endIndex <= startIndex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var result = new float[endIndex - startIndex];
|
||||
Array.Copy(samples, startIndex, result, 0, endIndex - startIndex);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
protected static byte[] ConvertArrayShortToBytes(short[] array)
|
||||
{
|
||||
var numArray = new byte[array.Length * 2];
|
||||
Buffer.BlockCopy(array, 0, numArray, 0, numArray.Length);
|
||||
return numArray;
|
||||
}
|
||||
|
||||
protected static short[] ConvertIeeeToPcm16(float[] source)
|
||||
{
|
||||
var resultBuffer = new short[source.Length];
|
||||
for (var i = 0; i < source.Length; i++)
|
||||
{
|
||||
var f = source[i] * 32768f;
|
||||
|
||||
if (f > (double)short.MaxValue)
|
||||
f = short.MaxValue;
|
||||
else if (f < (double)short.MinValue)
|
||||
f = short.MinValue;
|
||||
resultBuffer[i] = Convert.ToInt16(f);
|
||||
}
|
||||
|
||||
return resultBuffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
using BotSharp.NLP;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class AIConfiguration
|
||||
{
|
||||
private const string SERVICE_PROD_URL = "https://api.api.ai/v1/";
|
||||
private const string SERVICE_DEV_URL = "https://dev.api.ai/api/";
|
||||
|
||||
private const string CURRENT_PROTOCOL_VERSION = "20150910";
|
||||
|
||||
public string ClientAccessToken { get; private set; }
|
||||
|
||||
public string AgentId { get; set; }
|
||||
|
||||
public SupportedLanguage Language { get; set; }
|
||||
|
||||
public bool VoiceActivityDetectionEnabled { get; set; }
|
||||
|
||||
public string SessionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true, will be used Testing API.AI server instead of Production server. This option for TESTING PURPOSES ONLY.
|
||||
/// </summary>
|
||||
public bool DevMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true, all request and response content will be printed to the console. Use this option only FOR DEVELOPMENT.
|
||||
/// </summary>
|
||||
public bool DebugLog { get; set; }
|
||||
|
||||
string protocolVersion;
|
||||
public string ProtocolVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return protocolVersion;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
throw new ArgumentNullException("value");
|
||||
}
|
||||
protocolVersion = value;
|
||||
}
|
||||
}
|
||||
|
||||
public AIConfiguration(string clientAccessToken, SupportedLanguage language)
|
||||
{
|
||||
this.ClientAccessToken = clientAccessToken;
|
||||
this.Language = language;
|
||||
|
||||
DevMode = false;
|
||||
DebugLog = false;
|
||||
VoiceActivityDetectionEnabled = true;
|
||||
|
||||
ProtocolVersion = CURRENT_PROTOCOL_VERSION;
|
||||
}
|
||||
|
||||
public string RequestUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
var baseUrl = DevMode ? SERVICE_DEV_URL : SERVICE_PROD_URL;
|
||||
return string.Format("{0}{1}?v={2}", baseUrl, "query", ProtocolVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
[JsonObject]
|
||||
public class AIContext
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("parameters")]
|
||||
public Dictionary<string, object> Parameters { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Lifespan of the context measured in requests````
|
||||
/// </summary>
|
||||
[JsonProperty("lifespan")]
|
||||
public int Lifespan { get; set; }
|
||||
|
||||
public AIContext()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,180 +0,0 @@
|
|||
using BotSharp.Core.Engines.Dialogflow;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class AIDataService
|
||||
{
|
||||
private readonly AIConfiguration config;
|
||||
|
||||
public string SessionId { get; }
|
||||
|
||||
public AIDataService(AIConfiguration config)
|
||||
{
|
||||
this.config = config;
|
||||
|
||||
if (string.IsNullOrEmpty(config.SessionId))
|
||||
{
|
||||
SessionId = Guid.NewGuid().ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
SessionId = config.SessionId;
|
||||
}
|
||||
}
|
||||
|
||||
public AIResponse Request(AIRequest request)
|
||||
{
|
||||
request.Language = config.Language.code;
|
||||
request.Timezone = TimeZone.CurrentTimeZone.StandardName;
|
||||
request.SessionId = SessionId;
|
||||
|
||||
try
|
||||
{
|
||||
var httpRequest = (HttpWebRequest)WebRequest.Create(config.RequestUrl);
|
||||
httpRequest.Method = "POST";
|
||||
httpRequest.ContentType = "application/json; charset=utf-8";
|
||||
httpRequest.Accept = "application/json";
|
||||
|
||||
httpRequest.Headers.Add("Authorization", "Bearer " + config.ClientAccessToken);
|
||||
|
||||
var jsonSettings = new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver()
|
||||
};
|
||||
|
||||
var jsonRequest = JsonConvert.SerializeObject(request, Formatting.None, jsonSettings);
|
||||
|
||||
if (config.DebugLog)
|
||||
{
|
||||
Debug.WriteLine("Request: " + jsonRequest);
|
||||
}
|
||||
|
||||
using (var streamWriter = new StreamWriter(httpRequest.GetRequestStream()))
|
||||
{
|
||||
streamWriter.Write(jsonRequest);
|
||||
streamWriter.Close();
|
||||
}
|
||||
|
||||
var httpResponse = httpRequest.GetResponse() as HttpWebResponse;
|
||||
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
|
||||
{
|
||||
var result = streamReader.ReadToEnd();
|
||||
|
||||
if (config.DebugLog)
|
||||
{
|
||||
Debug.WriteLine("Response: " + result);
|
||||
}
|
||||
|
||||
var aiResponse = JsonConvert.DeserializeObject<AIResponse>(result);
|
||||
|
||||
CheckForErrors(aiResponse);
|
||||
|
||||
return aiResponse;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new AIServiceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public AIResponse VoiceRequest(Stream voiceStream, RequestExtras requestExtras = null)
|
||||
{
|
||||
var request = new AIRequest();
|
||||
request.Language = config.Language.code;
|
||||
request.Timezone = TimeZone.CurrentTimeZone.StandardName;
|
||||
request.SessionId = SessionId;
|
||||
|
||||
if (requestExtras != null)
|
||||
{
|
||||
requestExtras.CopyTo(request);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var httpRequest = (HttpWebRequest)WebRequest.Create(config.RequestUrl);
|
||||
httpRequest.Method = "POST";
|
||||
httpRequest.Accept = "application/json";
|
||||
|
||||
httpRequest.Headers.Add("Authorization", "Bearer " + config.ClientAccessToken);
|
||||
|
||||
var jsonSettings = new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
};
|
||||
|
||||
var jsonRequest = JsonConvert.SerializeObject(request, Formatting.None, jsonSettings);
|
||||
|
||||
if (config.DebugLog)
|
||||
{
|
||||
Debug.WriteLine("Request: " + jsonRequest);
|
||||
}
|
||||
|
||||
var multipartClient = new MultipartHttpClient(httpRequest);
|
||||
multipartClient.connect();
|
||||
|
||||
multipartClient.addStringPart("request", jsonRequest);
|
||||
multipartClient.addFilePart("voiceData", "voice.wav", voiceStream);
|
||||
|
||||
multipartClient.finish();
|
||||
|
||||
var responseJsonString = multipartClient.getResponse();
|
||||
|
||||
if (config.DebugLog)
|
||||
{
|
||||
Debug.WriteLine("Response: " + responseJsonString);
|
||||
}
|
||||
|
||||
var aiResponse = JsonConvert.DeserializeObject<AIResponse>(responseJsonString);
|
||||
|
||||
CheckForErrors(aiResponse);
|
||||
|
||||
return aiResponse;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new AIServiceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ResetContexts()
|
||||
{
|
||||
var cleanRequest = new AIRequest("empty_query_for_resetting_contexts");
|
||||
cleanRequest.ResetContexts = true;
|
||||
try
|
||||
{
|
||||
var response = Request(cleanRequest);
|
||||
return !response.IsError;
|
||||
}
|
||||
catch (AIServiceException e)
|
||||
{
|
||||
Debug.WriteLine("Exception while contexts clean." + e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void CheckForErrors(AIResponse aiResponse)
|
||||
{
|
||||
if (aiResponse == null)
|
||||
{
|
||||
throw new AIServiceException("API.AI response parsed as null. Check debug log for details.");
|
||||
}
|
||||
|
||||
if (aiResponse.IsError)
|
||||
{
|
||||
throw new AIServiceException(aiResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class AIRequest : QuestionMetadata
|
||||
{
|
||||
public string[] Query { get; set; }
|
||||
|
||||
public float[] Confidence { get; set; }
|
||||
|
||||
public List<AIContext> Contexts { get; set; }
|
||||
|
||||
public bool? ResetContexts { get; set; }
|
||||
|
||||
public OriginalRequest OriginalRequest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Agent directory
|
||||
/// </summary>
|
||||
public string AgentDir { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// What model is used to predict.
|
||||
/// </summary>
|
||||
public string Model { get; set; }
|
||||
|
||||
public AIRequest()
|
||||
{
|
||||
Contexts = new List<AIContext>();
|
||||
}
|
||||
|
||||
public AIRequest(string text)
|
||||
{
|
||||
Query = new string[] { text };
|
||||
Confidence = new float[] { 1.0f };
|
||||
Contexts = new List<AIContext>();
|
||||
}
|
||||
|
||||
public AIRequest(string text, RequestExtras requestExtras) : this(text)
|
||||
{
|
||||
if (requestExtras != null)
|
||||
{
|
||||
requestExtras.CopyTo(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class AIResponse
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
||||
public DateTime Timestamp { get; set; }
|
||||
|
||||
public string Lang { get; set; }
|
||||
|
||||
public AIResponseResult Result { get; set; }
|
||||
|
||||
public AIResponseStatus Status { get; set; }
|
||||
|
||||
public string SessionId { get; set; }
|
||||
|
||||
public bool IsError
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Status != null && Status.Code >= 400)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class AIResponseCustomPayload : AIResponseMessageBase
|
||||
{
|
||||
public string Task { get; set; }
|
||||
|
||||
public List<String> Parameters { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class AIResponseFulfillment
|
||||
{
|
||||
public string Speech { get; set; }
|
||||
|
||||
public List<Object> Messages { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
using BotSharp.Platform.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class AIResponseMessageBase
|
||||
{
|
||||
public AIResponseMessageType Type { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class AIResponseMetadata
|
||||
{
|
||||
public string IntentId { get; set; }
|
||||
public string IntentName { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,150 +0,0 @@
|
|||
using BotSharp.Models.NLP;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class AIResponseResult
|
||||
{
|
||||
String action;
|
||||
|
||||
public Boolean ActionIncomplete { get; set; }
|
||||
|
||||
public String Action
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(action))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return action;
|
||||
}
|
||||
set
|
||||
{
|
||||
action = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, object> Parameters { get; set; }
|
||||
|
||||
public List<NlpEntity> Entities { get; set; }
|
||||
|
||||
public AIContext[] Contexts { get; set; }
|
||||
|
||||
public AIResponseMetadata Metadata { get; set; }
|
||||
|
||||
public String ResolvedQuery { get; set; }
|
||||
|
||||
public AIResponseFulfillment Fulfillment { get; set; }
|
||||
|
||||
public string Source { get; set; }
|
||||
|
||||
public decimal Score { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public bool HasParameters
|
||||
{
|
||||
get
|
||||
{
|
||||
return Parameters != null && Parameters.Count > 0;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetStringParameter(string name, string defaultValue = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
|
||||
if (Parameters.ContainsKey(name))
|
||||
{
|
||||
return Parameters[name].ToString();
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public int GetIntParameter(string name, int defaultValue = 0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
|
||||
if (Parameters.ContainsKey(name))
|
||||
{
|
||||
var parameterValue = Parameters[name].ToString();
|
||||
int result;
|
||||
if (int.TryParse(parameterValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
float floatResult;
|
||||
if (float.TryParse(parameterValue, NumberStyles.Float, CultureInfo.InvariantCulture, out floatResult))
|
||||
{
|
||||
result = Convert.ToInt32(floatResult);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public float GetFloatParameter(string name, float defaultValue = 0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentNullException("name");
|
||||
}
|
||||
|
||||
if (Parameters.ContainsKey(name))
|
||||
{
|
||||
var parameterValue = Parameters[name].ToString();
|
||||
float result;
|
||||
if (float.TryParse(parameterValue, NumberStyles.Float, CultureInfo.InvariantCulture, out result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public JObject GetJsonParameter(string name, JObject defaultValue = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty("name"))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
if (Parameters.ContainsKey(name))
|
||||
{
|
||||
var parameter = Parameters[name].ToString();
|
||||
if (parameter != null)
|
||||
{
|
||||
return JObject.FromObject(parameter);
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public AIContext GetContext(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentException("Name must be not empty", nameof(name));
|
||||
}
|
||||
|
||||
return Contexts?.FirstOrDefault(c => string.Equals(c.Name, name, StringComparison.CurrentCultureIgnoreCase));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class AIResponseStatus
|
||||
{
|
||||
public int Code { get; set; }
|
||||
|
||||
public string ErrorType { get; set; }
|
||||
|
||||
public string ErrorDetails { get; set; }
|
||||
|
||||
public string ErrorID { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class AIServiceException : Exception
|
||||
{
|
||||
public AIResponse Response { get; set; }
|
||||
|
||||
public AIServiceException()
|
||||
{
|
||||
}
|
||||
|
||||
public AIServiceException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public AIServiceException(string message, Exception innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
public AIServiceException(Exception e) : base(e.Message, e)
|
||||
{
|
||||
}
|
||||
|
||||
public AIServiceException(AIResponse response)
|
||||
{
|
||||
Response = response;
|
||||
}
|
||||
|
||||
public override string Message
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Response != null && Response.IsError)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Response.Status.ErrorDetails))
|
||||
{
|
||||
return Response.Status.ErrorDetails;
|
||||
}
|
||||
}
|
||||
|
||||
return base.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
using BotSharp.Platform.Models;
|
||||
using BotSharp.Platform.Models.Intents;
|
||||
using BotSharp.Platform.Models.MachineLearning;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class AgentModel : AgentBase
|
||||
{
|
||||
public AgentModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Boolean Published { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Only access text/ audio rquest
|
||||
/// </summary>
|
||||
[StringLength(32)]
|
||||
public String ClientAccessToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Developer can access more APIs
|
||||
/// </summary>
|
||||
[StringLength(32)]
|
||||
public String DeveloperAccessToken { get; set; }
|
||||
|
||||
public List<Intent> Intents { get; set; }
|
||||
|
||||
[JsonProperty("entity_types")]
|
||||
public List<EntityType> Entities { get; set; }
|
||||
|
||||
public String Birthday
|
||||
{
|
||||
get
|
||||
{
|
||||
return CreatedDate.ToShortDateString();
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean IsSkillSet { get; set; }
|
||||
|
||||
public AgentMlConfig MlConfig { get; set; }
|
||||
|
||||
public List<AgentIntegration> Integrations { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class DialogflowAgentImportModel
|
||||
{
|
||||
public String Id { get; set; }
|
||||
public String Name { get; set; }
|
||||
public String Description { get; set; }
|
||||
public Boolean Published { get; set; }
|
||||
|
||||
public String DefaultTimezone { get; set; }
|
||||
public String Language { get; set; }
|
||||
|
||||
public decimal MlMinConfidence { get; set; }
|
||||
public string CustomClassifierMode { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
[JsonObject]
|
||||
public class DialogflowEntity
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("entries")]
|
||||
public List<DialogflowEntityEntry> Entries { get; set; }
|
||||
|
||||
public DialogflowEntity()
|
||||
{
|
||||
}
|
||||
|
||||
public DialogflowEntity(string name)
|
||||
{
|
||||
this.Name = name;
|
||||
}
|
||||
|
||||
public DialogflowEntity(string name, List<DialogflowEntityEntry> entries)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Entries = entries;
|
||||
}
|
||||
|
||||
public void AddEntry(DialogflowEntityEntry entry)
|
||||
{
|
||||
if (Entries == null)
|
||||
{
|
||||
Entries = new List<DialogflowEntityEntry>();
|
||||
}
|
||||
|
||||
Entries.Add(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
[JsonObject]
|
||||
public class DialogflowEntityEntry
|
||||
{
|
||||
[JsonProperty("value")]
|
||||
public string Value { get; set; }
|
||||
|
||||
public List<String> RawSynonyms { get; set; }
|
||||
|
||||
public List<EntrySynonym> Synonyms { get; set; }
|
||||
|
||||
public DialogflowEntityEntry()
|
||||
{
|
||||
}
|
||||
|
||||
public DialogflowEntityEntry(string value, List<string> synonyms)
|
||||
{
|
||||
this.Value = value;
|
||||
this.RawSynonyms = synonyms;
|
||||
}
|
||||
|
||||
public DialogflowEntityEntry(string value, string[] synonyms) : this(value, new List<string>(synonyms))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class DialogflowIntent
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public bool Auto { get; set; }
|
||||
/// <summary>
|
||||
/// Input Contexts
|
||||
/// </summary>
|
||||
public List<String> ContextList { get; set; }
|
||||
|
||||
public List<DialogflowIntentExpression> UserSays { get; set; }
|
||||
public List<DialogflowIntentResponse> Responses { get; set; }
|
||||
public int Priority { get; set; }
|
||||
public bool WebhookUsed { get; set; }
|
||||
public bool FallbackIntent { get; set; }
|
||||
public List<DialogflowIntentEvent> Events { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class DialogflowIntentEvent
|
||||
{
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class DialogflowIntentExpression
|
||||
{
|
||||
public String Id { get; set; }
|
||||
public List<DialogflowIntentExpressionPart> Data { get; set; }
|
||||
public Boolean IsTemplate { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class DialogflowIntentExpressionPart
|
||||
{
|
||||
public String Text { get; set; }
|
||||
public String Alias { get; set; }
|
||||
public String Meta { get; set; }
|
||||
public int Start { get; set; }
|
||||
public Boolean UserDefined { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class DialogflowIntentResponse
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public bool ResetContexts { get; set; }
|
||||
public string Action { get; set; }
|
||||
|
||||
public List<AIContext> AffectedContexts { get; set; }
|
||||
|
||||
public List<DialogflowIntentResponseParameter> Parameters { get; set; }
|
||||
|
||||
public List<DialogflowIntentResponseMessage> MessageList { get; set; }
|
||||
|
||||
public DialogflowIntentResponse()
|
||||
{
|
||||
Id = Guid.NewGuid().ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class DialogflowIntentResponseMessage : AIResponseMessageBase
|
||||
{
|
||||
public Object Speech { get; set; }
|
||||
public Object Payload { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class DialogflowIntentResponseParameter
|
||||
{
|
||||
public DialogflowIntentResponseParameter()
|
||||
{
|
||||
PromptList = new List<DialogflowIntentResponseParameterPrompt>();
|
||||
}
|
||||
public string Id { get; set; }
|
||||
public bool Required { get; set; }
|
||||
public string DataType { get; set; }
|
||||
public string DefaultValue { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
public bool IsList { get; set; }
|
||||
|
||||
public List<DialogflowIntentResponseParameterPrompt> PromptList { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class DialogflowIntentResponseParameterPrompt
|
||||
{
|
||||
public string Lang { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
using EntityFrameworkCore.BootKit;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class EntityEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Guid
|
||||
/// </summary>
|
||||
[StringLength(36)]
|
||||
public String Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(36)]
|
||||
public String EntityId { get; set; }
|
||||
|
||||
[MaxLength(64)]
|
||||
public String Value { get; set; }
|
||||
|
||||
[ForeignKey("EntityEntryId")]
|
||||
public List<EntrySynonym> Synonyms { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
using BotSharp.Platform.Abstraction;
|
||||
using BotSharp.Platform.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class EntityModel : EntityBase
|
||||
{
|
||||
public string Agent { get; set; }
|
||||
|
||||
public string EntityName { get; set; }
|
||||
|
||||
public string Type { get; set; }
|
||||
|
||||
public string UiColor { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
using EntityFrameworkCore.BootKit;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class EntityType
|
||||
{
|
||||
/// <summary>
|
||||
/// Guid
|
||||
/// </summary>
|
||||
[StringLength(36)]
|
||||
public String Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(36)]
|
||||
public String AgentId { get; set; }
|
||||
|
||||
[Required]
|
||||
[MaxLength(64)]
|
||||
public String Name { get; set; }
|
||||
|
||||
[MaxLength(256)]
|
||||
public String Description { get; set; }
|
||||
|
||||
[ForeignKey("EntityId")]
|
||||
public List<EntityEntry> Entries { get; set; }
|
||||
|
||||
public bool IsOverridable { get; set; }
|
||||
|
||||
public bool IsEnum { get; set; }
|
||||
|
||||
[StringLength(6)]
|
||||
public string Color { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Entries count
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public int Count { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
using EntityFrameworkCore.BootKit;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class EntrySynonym
|
||||
{
|
||||
/// <summary>
|
||||
/// Guid
|
||||
/// </summary>
|
||||
[StringLength(36)]
|
||||
public String Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(36)]
|
||||
public String EntityEntryId { get; set; }
|
||||
|
||||
[MaxLength(128)]
|
||||
public String Synonym { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
[JsonObject]
|
||||
public class OriginalRequest
|
||||
{
|
||||
[JsonProperty("source")]
|
||||
public string Source { get; set; }
|
||||
|
||||
[JsonProperty("data")]
|
||||
public object Data { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
[JsonObject]
|
||||
public class QuestionMetadata
|
||||
{
|
||||
[JsonProperty("timezone")]
|
||||
public string Timezone { get; set; }
|
||||
|
||||
[JsonProperty("lang")]
|
||||
public string Language { get; set; }
|
||||
|
||||
[JsonProperty("sessionId")]
|
||||
internal string SessionId { get; set; }
|
||||
|
||||
[JsonProperty("entities")]
|
||||
public List<EntityType> Entities { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.Models
|
||||
{
|
||||
public class RequestExtras
|
||||
{
|
||||
public List<AIContext> Contexts { get; set; }
|
||||
|
||||
public List<EntityType> Entities { get; set; }
|
||||
|
||||
public bool HasContexts
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Contexts != null && Contexts.Count > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasEntities
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Entities != null && Entities.Count > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public RequestExtras()
|
||||
{
|
||||
}
|
||||
|
||||
public RequestExtras(List<AIContext> contexts, List<EntityType> entities)
|
||||
{
|
||||
this.Contexts = contexts;
|
||||
this.Entities = entities;
|
||||
}
|
||||
|
||||
public void CopyTo(AIRequest request)
|
||||
{
|
||||
if (HasContexts)
|
||||
{
|
||||
request.Contexts = Contexts;
|
||||
}
|
||||
|
||||
if (HasEntities)
|
||||
{
|
||||
request.Entities = Entities;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
|
||||
namespace BotSharp.Core.Engines.Dialogflow
|
||||
{
|
||||
public class MultipartHttpClient
|
||||
{
|
||||
private const string delimiter = "--";
|
||||
private string boundary = "SwA" + DateTime.UtcNow.Ticks.ToString("x") + "SwA";
|
||||
private HttpWebRequest request;
|
||||
private BinaryWriter os;
|
||||
|
||||
public MultipartHttpClient(HttpWebRequest request)
|
||||
{
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
public void connect()
|
||||
{
|
||||
request.ContentType = "multipart/form-data; boundary=" + boundary;
|
||||
request.SendChunked = true;
|
||||
request.KeepAlive = true;
|
||||
|
||||
os = new BinaryWriter(request.GetRequestStream(), Encoding.UTF8);
|
||||
}
|
||||
|
||||
public void addStringPart(string paramName, string data)
|
||||
{
|
||||
WriteString(delimiter + boundary + "\r\n");
|
||||
WriteString("Content-Type: application/json\r\n");
|
||||
WriteString("Content-Disposition: form-data; name=\"" + paramName + "\"\r\n");
|
||||
WriteString("\r\n" + data + "\r\n");
|
||||
}
|
||||
|
||||
public void addFilePart(string paramName, string fileName, Stream data)
|
||||
{
|
||||
WriteString(delimiter + boundary + "\r\n");
|
||||
WriteString("Content-Disposition: form-data; name=\"" + paramName + "\"; filename=\"" + fileName + "\"\r\n");
|
||||
WriteString("Content-Type: audio/wav\r\n");
|
||||
|
||||
WriteString("\r\n");
|
||||
|
||||
int bufferSize = 4096;
|
||||
byte[] buffer = new byte[bufferSize];
|
||||
|
||||
int bytesActuallyRead;
|
||||
|
||||
bytesActuallyRead = data.Read(buffer, 0, bufferSize);
|
||||
while (bytesActuallyRead > 0)
|
||||
{
|
||||
os.Write(buffer, 0, bytesActuallyRead);
|
||||
bytesActuallyRead = data.Read(buffer, 0, bufferSize);
|
||||
}
|
||||
|
||||
WriteString("\r\n");
|
||||
}
|
||||
|
||||
public void finish()
|
||||
{
|
||||
WriteString(delimiter + boundary + delimiter + "\r\n");
|
||||
os.Close();
|
||||
}
|
||||
|
||||
private void WriteString(string str)
|
||||
{
|
||||
os.Write(Encoding.UTF8.GetBytes(str));
|
||||
}
|
||||
|
||||
public string getResponse()
|
||||
{
|
||||
try
|
||||
{
|
||||
var httpResponse = request.GetResponse() as HttpWebResponse;
|
||||
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
|
||||
{
|
||||
var result = streamReader.ReadToEnd();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
catch (WebException we)
|
||||
{
|
||||
using (var stream = we.Response.GetResponseStream())
|
||||
{
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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)'=='RASA|AnyCPU'">
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<OutputPath>bin\RASA</OutputPath>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DIALOGFLOW|AnyCPU'">
|
||||
<DefineConstants>DEBUG;TRACE;DIALOGFLOW;NETSTANDARD;NETSTANDARD2_0</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'">
|
||||
<DefineConstants>TRACE;DEBUG;DIALOGFLOW</DefineConstants>
|
||||
<OutputPath>bin\DIALOGFLOW</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BotSharp.Core\BotSharp.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.ViewModels
|
||||
{
|
||||
public class DialogflowAllEntityViewModel
|
||||
{
|
||||
public int Count { get; set; }
|
||||
|
||||
public string Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Preview { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text;
|
||||
|
||||
namespace Platform.Dialogflow.ViewModels
|
||||
{
|
||||
public class QueryModel
|
||||
{
|
||||
public QueryModel()
|
||||
{
|
||||
Contexts = new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Array of additional context objects. Should be sent via a POST /query request.
|
||||
/// Contexts sent in a query are activated before the query.
|
||||
/// </summary>
|
||||
public List<String> Contexts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Object containing event name and additional data.
|
||||
/// The "data" parameter can be submitted only in POST requests.
|
||||
/// </summary>
|
||||
public String Event { get;set; }
|
||||
|
||||
/// <summary>
|
||||
/// Language tag, e.g., en, es etc.
|
||||
/// </summary>
|
||||
public String Lang { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Natural language text to be processed. Query length should not exceed 256 characters.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public String Query { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A string token up to 36 symbols long, used to identify the client and to manage session parameters (including contexts) per client.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public String SessionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Time zone from IANA Time Zone Database Examples: America/New_York, Europe/Paris
|
||||
/// </summary>
|
||||
public String Timezone { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -16,10 +16,6 @@ The Open Source AI Bot Platform Builder
|
|||
:alt: NuGet
|
||||
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<img src="https://raw.githubusercontent.com/Oceania2018/BotSharp/master/BotSharp.WebHost/wwwroot/images/BotSharp.png" width="100px">
|
||||
|
||||
This project is for learning purposes only, please do not use it in a production environment.
|
||||
**********************************************************************************************
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
.. raw:: html
|
||||
|
||||
<img src="https://raw.githubusercontent.com/Oceania2018/BotSharp/master/BotSharp.WebHost/wwwroot/images/BotSharp.png" width="100px">
|
||||
|
||||
开源人工智能聊天机器人平台构建框架
|
||||
===============================
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue