Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
KayMKM committed Oct 9, 2018
2 parents 7abbd6d + 5322968 commit d4eceb3
Show file tree
Hide file tree
Showing 341 changed files with 20,073 additions and 240,280 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,5 @@ ASALocalRun/
*.bot

# AppSettings
/solutions/Virtual-Assistant/src/csharp/assistant/appsettings.development.json
/solutions/Virtual-Assistant/src/csharp/assistant/appsettings.production.json

**/appsettings.production.json
**/appsettings.development.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Once the Solution has been cloned you will see the following folder structure.

### Build the Solution

Once cloned the next step it to build the VirtualAssistant solution within Visual Studio. Deployment must have been completed before you can run the project due to this stage creating key dependencies in Azure along with your configured .bot file.
Once cloned the next step is to build the VirtualAssistant solution within Visual Studio. Deployment must have been completed before you can run the project due to this stage creating key dependencies in Azure along with your configured .bot file.

### Deployment

Expand Down Expand Up @@ -138,7 +138,7 @@ The [Add Authentication to your bot](https://docs.microsoft.com/en-us/azure/bot-
- Leave Logout URL blank.
- Under Microsoft Graph Permissions, you can need to add additional *delegated* permissions.
- Each of the Skills require a specific set of Scopes, refer to the documentation for each skill or use the following list of Scopes that contain the scopes needed for all skills.
- `Calendars.ReadWrite`, `Mail.Read`, `Mail.Send`, `Notes.ReadWrite`, `People.Read`, `User.Read`
- `Calendars.ReadWrite`, `Mail.Read`, `Mail.Send`, `Notes.ReadWrite.All`, `People.Read.All`, `User.Read.All`

Next you need to create the Authentication Connection for your Bot. Ensure you use the same combination of Scopes that you provided in the above command. The first command shown below will retrieve the appId (ApplicationId) and appPassword (Client Secret) that you need to complete this step.

Expand All @@ -147,7 +147,7 @@ The commands shown below assume you have used the deployment process and your re
```shell
msbot get production --secret YOUR_SECRET

az bot authsetting create --resource-group YOUR_BOT_NAME --name YOUR_BOT_NAME --setting-name "YOUR_AUTH_CONNECTION_NAME" --client-id "YOUR_APPLICATION_ID" --client-secret "YOUR_APPLICATION_PASSWORD" --provider-scope-string "Calendars.ReadWrite Mail.Read Mail.Send Notes.ReadWrite People.Read User.Read" --service Aadv2
az bot authsetting create --resource-group YOUR_BOT_NAME --name YOUR_BOT_NAME --setting-name "YOUR_AUTH_CONNECTION_NAME" --client-id "YOUR_APPLICATION_ID" --client-secret "YOUR_APPLICATION_PASSWORD" --provider-scope-string "Calendars.ReadWrite Mail.Read Mail.Send Notes.ReadWrite.All People.Read.All User.Read.All" --service Aadv2
```

The final step is to update your .bot file and associated Skills (in appSettings.config) with the Authentication connection name, this is used by the Assistant to enable Authentication prompts or use of Linked Accounts.
Expand Down
50 changes: 25 additions & 25 deletions solutions/Virtual-Assistant/src/csharp/VirtualAssistant.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VirtualAssistant", "assista
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Bot.Solutions", "Microsoft.Bot.Solutions\Microsoft.Bot.Solutions.csproj", "{0106AD2E-C570-42DF-B54B-3ACA50D58D80}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CalendarSkill", "skills\calendarskill\CalendarSkill.csproj", "{2DF1C042-7544-4885-AFE4-E7010369A519}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Skills", "Skills", "{1F423A0A-64D9-400C-B2B0-3AC378A5AB02}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EmailSkill", "skills\emailskill\EmailSkill.csproj", "{ACB52D46-6553-44EF-89AE-D3038406FA1E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CalendarSkill", "skills\CalendarSkill\CalendarSkill.csproj", "{3DA6F9E0-BE9F-4F16-8A41-A68948A01467}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PointOfInterestSkill", "skills\pointofinterestskill\PointOfInterestSkill.csproj", "{6BD03130-4931-410F-83EB-03E37E17E2B9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EmailSkill", "skills\EmailSkill\EmailSkill.csproj", "{F8A8F3D9-4C7E-442A-8ADF-F0C8586F41B7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ToDoSkill", "skills\ToDoSkill\ToDoSkill.csproj", "{3DE6A4B2-9241-4605-9E8C-BD17A1F71502}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PointOfInterestSkill", "skills\PointOfInterestSkill\PointOfInterestSkill.csproj", "{CB8CB4AF-B10B-4F0D-813F-5F9DA23B49FA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Skills", "Skills", "{5613E456-DD6D-4A16-AB48-D2F51CAC0526}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ToDoSkill", "skills\ToDoSkill\ToDoSkill.csproj", "{73DCD314-D2DE-452D-8B7A-9DAA964F0DCD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -37,31 +37,31 @@ Global
{0106AD2E-C570-42DF-B54B-3ACA50D58D80}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0106AD2E-C570-42DF-B54B-3ACA50D58D80}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0106AD2E-C570-42DF-B54B-3ACA50D58D80}.Release|Any CPU.Build.0 = Release|Any CPU
{2DF1C042-7544-4885-AFE4-E7010369A519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2DF1C042-7544-4885-AFE4-E7010369A519}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2DF1C042-7544-4885-AFE4-E7010369A519}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2DF1C042-7544-4885-AFE4-E7010369A519}.Release|Any CPU.Build.0 = Release|Any CPU
{ACB52D46-6553-44EF-89AE-D3038406FA1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ACB52D46-6553-44EF-89AE-D3038406FA1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ACB52D46-6553-44EF-89AE-D3038406FA1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ACB52D46-6553-44EF-89AE-D3038406FA1E}.Release|Any CPU.Build.0 = Release|Any CPU
{6BD03130-4931-410F-83EB-03E37E17E2B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6BD03130-4931-410F-83EB-03E37E17E2B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6BD03130-4931-410F-83EB-03E37E17E2B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6BD03130-4931-410F-83EB-03E37E17E2B9}.Release|Any CPU.Build.0 = Release|Any CPU
{3DE6A4B2-9241-4605-9E8C-BD17A1F71502}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DE6A4B2-9241-4605-9E8C-BD17A1F71502}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DE6A4B2-9241-4605-9E8C-BD17A1F71502}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DE6A4B2-9241-4605-9E8C-BD17A1F71502}.Release|Any CPU.Build.0 = Release|Any CPU
{3DA6F9E0-BE9F-4F16-8A41-A68948A01467}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DA6F9E0-BE9F-4F16-8A41-A68948A01467}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DA6F9E0-BE9F-4F16-8A41-A68948A01467}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DA6F9E0-BE9F-4F16-8A41-A68948A01467}.Release|Any CPU.Build.0 = Release|Any CPU
{F8A8F3D9-4C7E-442A-8ADF-F0C8586F41B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F8A8F3D9-4C7E-442A-8ADF-F0C8586F41B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F8A8F3D9-4C7E-442A-8ADF-F0C8586F41B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F8A8F3D9-4C7E-442A-8ADF-F0C8586F41B7}.Release|Any CPU.Build.0 = Release|Any CPU
{CB8CB4AF-B10B-4F0D-813F-5F9DA23B49FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB8CB4AF-B10B-4F0D-813F-5F9DA23B49FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB8CB4AF-B10B-4F0D-813F-5F9DA23B49FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB8CB4AF-B10B-4F0D-813F-5F9DA23B49FA}.Release|Any CPU.Build.0 = Release|Any CPU
{73DCD314-D2DE-452D-8B7A-9DAA964F0DCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73DCD314-D2DE-452D-8B7A-9DAA964F0DCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73DCD314-D2DE-452D-8B7A-9DAA964F0DCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73DCD314-D2DE-452D-8B7A-9DAA964F0DCD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{2DF1C042-7544-4885-AFE4-E7010369A519} = {5613E456-DD6D-4A16-AB48-D2F51CAC0526}
{ACB52D46-6553-44EF-89AE-D3038406FA1E} = {5613E456-DD6D-4A16-AB48-D2F51CAC0526}
{6BD03130-4931-410F-83EB-03E37E17E2B9} = {5613E456-DD6D-4A16-AB48-D2F51CAC0526}
{3DE6A4B2-9241-4605-9E8C-BD17A1F71502} = {5613E456-DD6D-4A16-AB48-D2F51CAC0526}
{3DA6F9E0-BE9F-4F16-8A41-A68948A01467} = {1F423A0A-64D9-400C-B2B0-3AC378A5AB02}
{F8A8F3D9-4C7E-442A-8ADF-F0C8586F41B7} = {1F423A0A-64D9-400C-B2B0-3AC378A5AB02}
{CB8CB4AF-B10B-4F0D-813F-5F9DA23B49FA} = {1F423A0A-64D9-400C-B2B0-3AC378A5AB02}
{73DCD314-D2DE-452D-8B7A-9DAA964F0DCD} = {1F423A0A-64D9-400C-B2B0-3AC378A5AB02}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7569C2D0-1323-45B5-8CFF-3ECACD9E0B82}
Expand Down
27 changes: 25 additions & 2 deletions solutions/Virtual-Assistant/src/csharp/assistant/BotServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.Bot.Builder.AI.Luis;
Expand All @@ -27,7 +28,7 @@ public class BotServices
/// Initializes a new instance of the <see cref="BotServices"/> class.
/// </summary>
/// <param name="botConfiguration">The <see cref="BotConfiguration"/> instance for the bot.</param>
public BotServices(BotConfiguration botConfiguration)
public BotServices(BotConfiguration botConfiguration, List<SkillDefinition> skills)
{
foreach (var service in botConfiguration.Services)
{
Expand Down Expand Up @@ -102,6 +103,25 @@ public BotServices(BotConfiguration botConfiguration)
}
}
}

foreach(var skill in skills)
{
var skillConfig = new SkillConfiguration()
{
AuthConnectionName = AuthConnectionName,
CosmosDbOptions = CosmosDbOptions,
TelemetryClient = TelemetryClient,
LuisServices = LuisServices.Where(l => skill.LuisServiceIds.Contains(l.Key) == true).ToDictionary(l => l.Key, l => l.Value as LuisRecognizer),
};

foreach (var set in skill.Configuration)
{
skillConfig.Properties.Add(set.Key, set.Value);
}

SkillDefinitions.Add(skill);
SkillConfigurations.Add(skill.Id, skillConfig);
}
}

public CosmosDbStorageOptions CosmosDbOptions { get; }
Expand Down Expand Up @@ -157,6 +177,9 @@ public BotServices(BotConfiguration botConfiguration)
/// </value>
public Dictionary<string, TelemetryQnAMaker> QnAServices { get; } = new Dictionary<string, TelemetryQnAMaker>();

public List<SkillService> RegisteredSkills { get; set; } = new List<SkillService>();
public List<SkillDefinition> SkillDefinitions { get; set; } = new List<SkillDefinition>();

public Dictionary<string, SkillConfiguration> SkillConfigurations = new Dictionary<string, SkillConfiguration>();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

using VirtualAssistant.Dialogs.Cancel.Resources;
using Microsoft.Bot.Builder.TemplateManager;
using Microsoft.Bot.Builder;
using Microsoft.Bot.Schema;

namespace VirtualAssistant
{
Expand All @@ -19,8 +21,8 @@ public class CancelResponses : TemplateManager
["default"] = new TemplateIdMap
{
{ _confirmPrompt, (context, data) => CancelStrings.CANCEL_PROMPT },
{ _cancelConfirmed, (context, data) => CancelStrings.CANCEL_CONFIRMED },
{ _cancelDenied, (context, data) => CancelStrings.CANCEL_DENIED },
{ _cancelConfirmed, (context, data) => SendAcceptingInputReply(context, CancelStrings.CANCEL_CONFIRMED) },
{ _cancelDenied, (context, data) => SendAcceptingInputReply(context, CancelStrings.CANCEL_DENIED) },
},
["en"] = new TemplateIdMap { },
["fr"] = new TemplateIdMap { },
Expand All @@ -30,5 +32,14 @@ public CancelResponses()
{
Register(new DictionaryRenderer(_responseTemplates));
}

public static IMessageActivity SendAcceptingInputReply(ITurnContext turnContext, string text)
{
var reply = turnContext.Activity.CreateReply();
reply.InputHint = InputHints.AcceptingInput;
reply.Text = text;

return reply;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

using VirtualAssistant.Dialogs.Escalate.Resources;
using Microsoft.Bot.Builder.TemplateManager;
using Microsoft.Bot.Schema;
using Microsoft.Bot.Builder;

namespace VirtualAssistant
{
Expand All @@ -14,7 +16,7 @@ public class EscalateResponses : TemplateManager
{
["default"] = new TemplateIdMap
{
{ SendPhone, (context, data) => EscalateStrings.PHONE_INFO },
{ SendPhone, (context, data) => SendAcceptingInputReply(context, EscalateStrings.PHONE_INFO) },
},
["en"] = new TemplateIdMap { },
["fr"] = new TemplateIdMap { },
Expand All @@ -24,5 +26,14 @@ public EscalateResponses()
{
Register(new DictionaryRenderer(_responseTemplates));
}

public static IMessageActivity SendAcceptingInputReply(ITurnContext turnContext, string text)
{
var reply = turnContext.Activity.CreateReply();
reply.InputHint = InputHints.AcceptingInput;
reply.Text = text;

return reply;
}
}
}
Loading

0 comments on commit d4eceb3

Please sign in to comment.