diff --git a/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Services/BotServices.cs b/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Services/BotServices.cs index 858eca7bcf..eab1e7471f 100644 --- a/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Services/BotServices.cs +++ b/templates/Virtual-Assistant-Template/csharp/Sample/VirtualAssistantSample/Services/BotServices.cs @@ -2,8 +2,10 @@ // Licensed under the MIT License. using System.Collections.Generic; +using Microsoft.ApplicationInsights; using Microsoft.Bot.Builder.AI.Luis; using Microsoft.Bot.Builder.AI.QnA; +using Microsoft.Bot.Builder.ApplicationInsights; using Microsoft.Bot.Builder.Solutions; namespace VirtualAssistantSample.Services @@ -22,15 +24,23 @@ public BotServices(BotSettings settings) var language = pair.Key; var config = pair.Value; + var telemetryClient = new BotTelemetryClient(new TelemetryClient(settings.AppInsights)); + var luisOptions = new LuisPredictionOptions() + { + TelemetryClient = telemetryClient, + LogPersonalInformation = true, + }; + var dispatchApp = new LuisApplication(config.DispatchModel.AppId, config.DispatchModel.SubscriptionKey, config.DispatchModel.GetEndpoint()); - set.DispatchService = new LuisRecognizer(dispatchApp); + + set.DispatchService = new LuisRecognizer(dispatchApp, luisOptions); if (config.LanguageModels != null) { foreach (var model in config.LanguageModels) { var luisApp = new LuisApplication(model.AppId, model.SubscriptionKey, model.GetEndpoint()); - set.LuisServices.Add(model.Id, new LuisRecognizer(luisApp)); + set.LuisServices.Add(model.Id, new LuisRecognizer(luisApp, luisOptions)); } } @@ -42,7 +52,8 @@ public BotServices(BotSettings settings) EndpointKey = kb.EndpointKey, Host = kb.Hostname, }; - var qnaMaker = new QnAMaker(qnaEndpoint); + + var qnaMaker = new QnAMaker(qnaEndpoint, null, null, telemetryClient: telemetryClient, logPersonalInformation: true); set.QnAServices.Add(kb.Id, qnaMaker); } diff --git a/templates/Virtual-Assistant-Template/csharp/Template/VA/Services/BotServices.cs b/templates/Virtual-Assistant-Template/csharp/Template/VA/Services/BotServices.cs index 1fd49d1376..e3b61b01cf 100644 --- a/templates/Virtual-Assistant-Template/csharp/Template/VA/Services/BotServices.cs +++ b/templates/Virtual-Assistant-Template/csharp/Template/VA/Services/BotServices.cs @@ -2,8 +2,10 @@ // Licensed under the MIT License. using System.Collections.Generic; +using Microsoft.ApplicationInsights; using Microsoft.Bot.Builder.AI.Luis; using Microsoft.Bot.Builder.AI.QnA; +using Microsoft.Bot.Builder.ApplicationInsights; using Microsoft.Bot.Builder.Solutions; namespace $safeprojectname$.Services @@ -22,15 +24,23 @@ public BotServices(BotSettings settings) var language = pair.Key; var config = pair.Value; + var telemetryClient = new BotTelemetryClient(new TelemetryClient(settings.AppInsights)); + var luisOptions = new LuisPredictionOptions() + { + TelemetryClient = telemetryClient, + LogPersonalInformation = true, + }; + var dispatchApp = new LuisApplication(config.DispatchModel.AppId, config.DispatchModel.SubscriptionKey, config.DispatchModel.GetEndpoint()); - set.DispatchService = new LuisRecognizer(dispatchApp); + + set.DispatchService = new LuisRecognizer(dispatchApp, luisOptions); if (config.LanguageModels != null) { foreach (var model in config.LanguageModels) { var luisApp = new LuisApplication(model.AppId, model.SubscriptionKey, model.GetEndpoint()); - set.LuisServices.Add(model.Id, new LuisRecognizer(luisApp)); + set.LuisServices.Add(model.Id, new LuisRecognizer(luisApp, luisOptions)); } } @@ -42,7 +52,8 @@ public BotServices(BotSettings settings) EndpointKey = kb.EndpointKey, Host = kb.Hostname, }; - var qnaMaker = new QnAMaker(qnaEndpoint); + + var qnaMaker = new QnAMaker(qnaEndpoint, null, null, telemetryClient: telemetryClient, logPersonalInformation: true); set.QnAServices.Add(kb.Id, qnaMaker); }