Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

[LG Updates] Post Merge and Lib updates #2603

Merged
merged 2 commits into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Threading;
using Microsoft.Bot.Builder;
using Microsoft.Bot.Builder.Adapters;
using Microsoft.Bot.Builder.AI.Luis;
Expand All @@ -12,10 +16,6 @@
using Microsoft.Bot.Connector.Authentication;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Threading;
using VirtualAssistantSample.Bots;
using VirtualAssistantSample.Dialogs;
using VirtualAssistantSample.Models;
Expand Down Expand Up @@ -66,7 +66,6 @@ public virtual void Initialize()
});

// For localization testing

CultureInfo.CurrentUICulture = new CultureInfo("en-us");

Dictionary<string, List<string>> localeLGFiles = new Dictionary<string, List<string>>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Microsoft.Bot.Schema;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks;
using Microsoft.Bot.Schema;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using VirtualAssistantSample.Tests.Utterances;

namespace VirtualAssistantSample.Tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Microsoft.Bot.Schema;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks;
using Microsoft.Bot.Schema;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json.Linq;
using VirtualAssistantSample.Models;

namespace VirtualAssistantSample.Tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.2" />
<PackageReference Include="Microsoft.Bot.Builder" Version="4.6.0-preview-191005-1" />
<PackageReference Include="Microsoft.Bot.Builder.LanguageGeneration.Templates" Version="4.6.0-preview-191009-2" />
<PackageReference Include="Microsoft.Bot.Builder" Version="4.6.0-rc1" />
<PackageReference Include="Microsoft.Bot.Builder.LanguageGeneration" Version="4.6.0-rc0-preview" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,37 @@ protected override async Task<InterruptionAction> OnInterruptDialogAsync(DialogC
{
case GeneralLuis.Intent.Cancel:
{
var template = _templateEngine.EvaluateTemplate("cancelledMessage");
var response = await _activityGenerator.CreateActivityFromText(template, null, dc.Context, _langGenerator);
await dc.Context.SendActivityAsync(response);
// No need to send the usual dialog completion message for utility capabilities such as these.
dc.SuppressCompletionMessage(true);

await dc.Context.SendActivityAsync(_templateEngine.GenerateActivityForLocale("CancelledMessage", userProfile));

await dc.CancelAllDialogsAsync();
return InterruptionAction.End;
}

case GeneralLuis.Intent.StartOver:
{
// No need to send the usual dialog completion message for utility capabilities such as these.
dc.SuppressCompletionMessage(true);

await dc.Context.SendActivityAsync(_templateEngine.GenerateActivityForLocale("StartOverMessage", userProfile));

await dc.CancelAllDialogsAsync();
return InterruptionAction.End;
}

case GeneralLuis.Intent.Escalate:
{
var template = _templateEngine.EvaluateTemplate("escalateMessage");
var response = await _activityGenerator.CreateActivityFromText(template, null, dc.Context, _langGenerator);
await dc.Context.SendActivityAsync(response);
await dc.Context.SendActivityAsync(_templateEngine.GenerateActivityForLocale("EscalateMessage", userProfile));
return InterruptionAction.Resume;
}

case GeneralLuis.Intent.Help:
{
// No need to send the usual dialog completion message for utility capabilities such as these.
dc.SuppressCompletionMessage(true);

if (isSkill)
{
// If current dialog is a skill, allow it to handle its own help intent.
Expand All @@ -146,19 +160,20 @@ protected override async Task<InterruptionAction> OnInterruptDialogAsync(DialogC
}
else
{
var template = _templateEngine.EvaluateTemplate("helpCard");
var response = await _activityGenerator.CreateActivityFromText(template, null, dc.Context, _langGenerator);
await dc.Context.SendActivityAsync(response);
await dc.Context.SendActivityAsync(_templateEngine.GenerateActivityForLocale("HelpCard", userProfile));
return InterruptionAction.Resume;
}
}

case GeneralLuis.Intent.Logout:
{
// No need to send the usual dialog completion message for utility capabilities such as these.
dc.SuppressCompletionMessage(true);

await LogUserOut(dc);
var template = _templateEngine.EvaluateTemplate("logoutMessage");
var response = await _activityGenerator.CreateActivityFromText(template, null, dc.Context, _langGenerator);
await dc.Context.SendActivityAsync(response);

await dc.Context.SendActivityAsync(_templateEngine.GenerateActivityForLocale("LogOutMessage", userProfile));

return InterruptionAction.End;
}

Expand All @@ -170,6 +185,9 @@ protected override async Task<InterruptionAction> OnInterruptDialogAsync(DialogC

case GeneralLuis.Intent.Repeat:
{
// No need to send the usual dialog completion message for utility capabilities such as these.
dc.SuppressCompletionMessage(true);

// Sends the activities since the last user message again.
var previousResponse = await _previousResponseAccessor.GetAsync(dc.Context, () => new List<Activity>());

Expand Down Expand Up @@ -315,12 +333,12 @@ protected override async Task OnUnhandledActivityTypeAsync(DialogContext innerDc
// Runs when the dialog stack completes.
protected override async Task OnDialogCompleteAsync(DialogContext outerDc, object result, CancellationToken cancellationToken = default)
{
var userProfile = await _userProfileState.GetAsync(outerDc.Context, () => new UserProfileState());

// Only send a completion message if the user sent a message activity.
if (outerDc.Context.Activity.Type == ActivityTypes.Message)
if (outerDc.Context.Activity.Type == ActivityTypes.Message && !outerDc.SuppressCompletionMessage())
{
var template = _templateEngine.EvaluateTemplate("completedMessage");
var response = await _activityGenerator.CreateActivityFromText(template, null, outerDc.Context, _langGenerator);
await outerDc.Context.SendActivityAsync(response);
await outerDc.Context.SendActivityAsync(_templateEngine.GenerateActivityForLocale("CompletedMessage", userProfile));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
Expand All @@ -14,16 +13,13 @@
using Microsoft.Bot.Builder.ApplicationInsights;
using Microsoft.Bot.Builder.Azure;
using Microsoft.Bot.Builder.BotFramework;
using Microsoft.Bot.Builder.Dialogs.Declarative.Resources;
using Microsoft.Bot.Builder.Integration.ApplicationInsights.Core;
using Microsoft.Bot.Builder.Integration.AspNet.Core;
using Microsoft.Bot.Builder.LanguageGeneration;
using Microsoft.Bot.Builder.Skills;
using Microsoft.Bot.Builder.Skills.Auth;
using Microsoft.Bot.Builder.Skills.Models.Manifest;
using Microsoft.Bot.Builder.Solutions.Authentication;
using Microsoft.Bot.Builder.Solutions.Responses;
using Microsoft.Bot.Builder.StreamingExtensions;
using Microsoft.Bot.Connector.Authentication;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -130,7 +126,7 @@ public void ConfigureServices(IServiceCollection services)
});
}

// IBotFrameworkHttpAdapter now supports both http and websockt transport
// IBotFrameworkHttpAdapter now supports both http and websocket transport
services.AddSingleton<IBotFrameworkHttpAdapter, DefaultAdapter>();

// Configure bot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,28 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AdaptiveCards" Version="1.2.0" />
<PackageReference Include="AdaptiveCards" Version="1.2.3" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.10.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.7.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.10.0" />
<PackageReference Include="Microsoft.AspNetCore.All" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.2" />
<PackageReference Include="Microsoft.Azure.CognitiveServices.ContentModerator" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.CognitiveServices.Language" Version="1.0.1-preview" />
<PackageReference Include="Microsoft.Bot.Builder" Version="4.6.0-rc0" />
<PackageReference Include="Microsoft.Bot.Builder.AI.Luis" Version="4.6.0-rc0" />
<PackageReference Include="Microsoft.Bot.Builder.AI.QnA" Version="4.6.0-rc0" />
<PackageReference Include="Microsoft.Bot.Builder.ApplicationInsights" Version="4.6.0-rc0" />
<PackageReference Include="Microsoft.Bot.Builder.Azure" Version="4.6.0-rc0" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs" Version="4.6.0-rc0" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.ApplicationInsights.Core" Version="4.6.0-rc0" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.6.0-rc0" />
<PackageReference Include="Microsoft.Bot.Builder.LanguageGeneration" Version="4.6.0-Daily-2019-09-25-01" />
<PackageReference Include="Microsoft.Bot.Builder.LanguageGeneration.Templates" Version="4.6.0-Daily-2019-10-04-01" />
<PackageReference Include="Microsoft.Bot.Builder.Skills" Version="4.6.0-rc0" />
<PackageReference Include="Microsoft.Bot.Builder.Solutions" Version="4.6.0-rc0" />
<PackageReference Include="Microsoft.Bot.Configuration" Version="4.6.0-rc0" />
<PackageReference Include="Microsoft.Bot.Connector" Version="4.6.0-rc0" />
<PackageReference Include="Microsoft.Bot.Schema" Version="4.6.0-rc0" />
<PackageReference Include="Microsoft.Bot.Builder" Version="4.6.0-rc1" />
<PackageReference Include="Microsoft.Bot.Builder.AI.Luis" Version="4.6.0-rc1" />
<PackageReference Include="Microsoft.Bot.Builder.AI.QnA" Version="4.6.0-rc1" />
<PackageReference Include="Microsoft.Bot.Builder.ApplicationInsights" Version="4.6.0-rc1" />
<PackageReference Include="Microsoft.Bot.Builder.Azure" Version="4.6.0-rc1" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs" Version="4.6.0-rc1" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.ApplicationInsights.Core" Version="4.6.0-rc1" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.6.0-rc1" />
<PackageReference Include="Microsoft.Bot.Builder.LanguageGeneration" Version="4.6.0-rc0-preview" />
<PackageReference Include="Microsoft.Bot.Builder.Skills" Version="4.6.0-daily62" />
<PackageReference Include="Microsoft.Bot.Builder.Solutions" Version="4.6.0-rc1" />
<PackageReference Include="Microsoft.Bot.Configuration" Version="4.6.0-rc1" />
<PackageReference Include="Microsoft.Bot.Connector" Version="4.6.0-rc1" />
<PackageReference Include="Microsoft.Bot.Schema" Version="4.6.0-rc1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.0" />
Expand Down