Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: lg naming migration #2597

Merged
merged 43 commits into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d2590dc
change - in template name to _ for all sample bots
cosmicshuai Apr 10, 2020
14e32c9
update lg naming pattern
zhixzhan Apr 10, 2020
4404067
update tests
zhixzhan Apr 10, 2020
7ef61eb
add method to convert template name when loading
cosmicshuai Apr 10, 2020
3ba6acc
Merge branch 'lg-naming-migration' of github.com:microsoft/BotFramewo…
cosmicshuai Apr 10, 2020
03c3e02
Inline LU naming conventions in the prompts
zhixzhan Apr 13, 2020
694b3a3
update lg name pattern
zhixzhan Apr 13, 2020
5286a6b
replace bfdactivity -> SendActivity
zhixzhan Apr 13, 2020
ab7f5ad
activity -> SendActivity
zhixzhan Apr 13, 2020
cde458e
bfdprompt_1234 -> TextInput_Prompt_1234
zhixzhan Apr 13, 2020
8218e92
designerId no dash -
zhixzhan Apr 14, 2020
f4a7d0f
lgField use schema.$kind as lgNameType
zhixzhan Apr 14, 2020
cdb2d88
use standalone method generate designer id
zhixzhan Apr 14, 2020
997ae11
Update packages
luhan2017 Apr 14, 2020
3e7f2f5
Update sdk.schema
luhan2017 Apr 14, 2020
8d12e03
more replacement
zhixzhan Apr 14, 2020
71be4a7
Merge branch 'lg-naming-migration' of https://github.com/microsoft/Bo…
zhixzhan Apr 14, 2020
7aa02a1
Merge branch 'master' into lg-naming-migration
zhixzhan Apr 14, 2020
bd5ce85
change LG package version
cosmicshuai Apr 14, 2020
4a3b2a7
upgrade lg package
zhixzhan Apr 14, 2020
07e19b2
fix api of Expression
cosmicshuai Apr 14, 2020
66e3330
Merge branch 'lg-naming-migration' of github.com:microsoft/BotFramewo…
cosmicshuai Apr 14, 2020
174ea22
Update BotProject.csproj
luhan2017 Apr 15, 2020
5ccc274
Merge branch 'master' into lg-naming-migration
luhan2017 Apr 15, 2020
05ab8df
update sample bot
zhixzhan Apr 15, 2020
90fe6a0
use SDKKinds
zhixzhan Apr 15, 2020
bed71e6
use shared lu name builder
zhixzhan Apr 15, 2020
4aceffb
Merge branch 'master' into lg-naming-migration
zhixzhan Apr 15, 2020
26513ca
Merge branch 'master' into lg-naming-migration
zhixzhan Apr 16, 2020
b0aab33
Merge branch 'master' into lg-naming-migration
cwhitten Apr 16, 2020
f496659
Update LanguagePolicy and IRecognzier
luhan2017 Apr 16, 2020
935f940
Recognizer -> IRecognizer
zhixzhan Apr 16, 2020
da71cce
Update to the latest 200416
luhan2017 Apr 16, 2020
ea93471
Merge branch 'master' into lg-naming-migration
luhan2017 Apr 16, 2020
e29a469
Merge branch 'master' into lg-naming-migration
zhixzhan Apr 17, 2020
88fd61b
Fix for skill AutoEndDialog
luhan2017 Apr 17, 2020
4d856c7
upgrade luis package
zhixzhan Apr 17, 2020
26fa66e
replace cover ${ } and @{ } expression syntax
zhixzhan Apr 17, 2020
550e910
upgrade luis package fix dash -
zhixzhan Apr 17, 2020
5665b29
Merge branch 'master' into lg-naming-migration
zhixzhan Apr 18, 2020
5292ee9
Merge branch 'master' into lg-naming-migration
luhan2017 Apr 18, 2020
b83ce5c
handle file write error
zhixzhan Apr 19, 2020
3823239
use a placeholder luSectionName
zhixzhan Apr 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions BotProject/Templates/CSharp/BotProject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.2" />
<PackageReference Include="Microsoft.Bot.Builder" Version="4.8.0" />
<PackageReference Include="Microsoft.Bot.Builder.ApplicationInsights" Version="4.8.0" />
<PackageReference Include="Microsoft.Bot.Builder.Azure" Version="4.8.0" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Adaptive" Version="4.8.0-rc0" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Debugging" Version="4.8.0-rc0" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Declarative" Version="4.8.0-rc0" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.ApplicationInsights.Core" Version="4.8.0" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.8.0" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs" Version="4.8.0" />
<PackageReference Include="Microsoft.Bot.Connector" Version="4.8.0" />
<PackageReference Include="Microsoft.Bot.Builder" Version="4.9.0-preview-200416-120718" />
<PackageReference Include="Microsoft.Bot.Builder.ApplicationInsights" Version="4.9.0-preview-200416-120718" />
<PackageReference Include="Microsoft.Bot.Builder.Azure" Version="4.9.0-preview-200416-120718" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Adaptive" Version="4.9.0-preview-200416-120718" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Debugging" Version="4.9.0-preview-200416-120718" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Declarative" Version="4.9.0-preview-200416-120718" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.ApplicationInsights.Core" Version="4.9.0-preview-200416-120718" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.9.0-preview-200416-120718" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs" Version="4.9.0-preview-200416-120718" />
<PackageReference Include="Microsoft.Bot.Connector" Version="4.9.0-preview-200416-120718" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.66">
<PrivateAssets>all</PrivateAssets>
Expand Down
24 changes: 20 additions & 4 deletions BotProject/Templates/CSharp/ComposerBot.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Security.Claims;
using System.Security.Principal;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Bot.Builder.AI.QnA;
Expand All @@ -10,6 +12,7 @@
using Microsoft.Bot.Builder.Dialogs.Declarative;
using Microsoft.Bot.Builder.Dialogs.Declarative.Resources;
using Microsoft.Bot.Builder.Skills;
using Microsoft.Bot.Connector.Authentication;

namespace Microsoft.Bot.Builder.ComposerBot.Json
{
Expand All @@ -21,8 +24,9 @@ public class ComposerBot : ActivityHandler
private readonly ConversationState conversationState;
private readonly IStatePropertyAccessor<DialogState> dialogState;
private readonly string rootDialogFile;
private readonly string defaultLocale;

public ComposerBot(ConversationState conversationState, UserState userState, ResourceExplorer resourceExplorer, BotFrameworkClient skillClient, SkillConversationIdFactoryBase conversationIdFactory, string rootDialog)
public ComposerBot(ConversationState conversationState, UserState userState, ResourceExplorer resourceExplorer, BotFrameworkClient skillClient, SkillConversationIdFactoryBase conversationIdFactory, string rootDialog, string defaultLocale)
{
HostContext.Current.Set(skillClient);
HostContext.Current.Set(conversationIdFactory);
Expand All @@ -31,11 +35,22 @@ public ComposerBot(ConversationState conversationState, UserState userState, Res
this.dialogState = conversationState.CreateProperty<DialogState>("DialogState");
this.resourceExplorer = resourceExplorer;
this.rootDialogFile = rootDialog;
this.defaultLocale = defaultLocale;
LoadRootDialogAsync();
}

public override async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
{
AdaptiveDialog rootDialog = (AdaptiveDialog)this.dialogManager.RootDialog;
if (turnContext.TurnState.Get<IIdentity>(BotAdapter.BotIdentityKey) is ClaimsIdentity claimIdentity && SkillValidation.IsSkillClaim(claimIdentity.Claims))
{
rootDialog.AutoEndDialog = true;
}
else
{
rootDialog.AutoEndDialog = false;
}

await this.dialogManager.OnTurnAsync(turnContext, cancellationToken: cancellationToken);
await this.conversationState.SaveChangesAsync(turnContext, false, cancellationToken);
await this.userState.SaveChangesAsync(turnContext, false, cancellationToken);
Expand All @@ -44,10 +59,11 @@ public ComposerBot(ConversationState conversationState, UserState userState, Res
private void LoadRootDialogAsync()
{
var rootFile = resourceExplorer.GetResource(rootDialogFile);
var rootDialog = resourceExplorer.LoadType<Dialog>(rootFile);
var rootDialog = resourceExplorer.LoadType<AdaptiveDialog>(rootFile);
this.dialogManager = new DialogManager(rootDialog)
.UseResourceExplorer(resourceExplorer)
.UseLanguageGeneration();
}
.UseLanguageGeneration()
.UseLanguagePolicy(new LanguagePolicy(defaultLocale));
}
}
}
Loading