Skip to content

Commit 565a5df

Browse files
authored
Release 'live' 07-25-2019 (MicrosoftDocs#1614)
1 parent 23a1808 commit 565a5df

File tree

5 files changed

+95
-12
lines changed

5 files changed

+95
-12
lines changed

articles/bot-service-debug-bot.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ In Visual Studio (VS), you can set breakpoints and run the bot in debug mode to
6464
> The **EchoBot** is default to using **Table Storage**. To use Table Storage in your bot, you need the table *name* and *key*. If you do not have a Table Storage instance ready, you can create one or for testing purposes, you can comment out the code that uses **TableBotDataStore** and uncomment the line of code that uses **InMemoryDataStore**. The **InMemoryDataStore** is intended for testing and prototyping only.
6565
-->
6666
![Set breakpoint in VS](~/media/bot-service-debug-bot/breakpoint-set-vs.png)
67+
6768
5. Start the Bot Framework Emulator and connect to your bot as described in the section above.
6869
6. From the emulator, send your bot a message (e.g.: send the message "Hi"). Execution will stop at the line where you place the breakpoint.
6970
![Debug in VS](~/media/bot-service-debug-bot/breakpoint-caught-vs.png)

articles/bot-service-debug-inspection-middleware.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This article describes how to debug your bot using inspection middleware, a new
1717
We use a basic Echo bot built with the [Bot Framework](https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/02.echo-bot) to show how to add the inspection middleware to debug your bot and inspect the bot's message state. You can also [Debug a bot using IDE](./bot-service-debug-bot.md) or [Debug with the Bot Framework Emulator](./bot-service-debug-emulator.md) but to debug state you need to add inspection middleware to your bot. The Inspection bot samples are available here: [C#](https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/47.inspection) and [JavaScript](https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/47.inspection).
1818

1919
## Prerequisites
20-
- Download and install the [Bot Framework Emulator](https://aka.ms/Emulator-wiki-getting-started).
20+
- Download and install the [Bot Framework Emulator](https://aka.ms/Emulator-wiki-getting-started)
2121
- Knowledge of bot [Middleware](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-concept-middleware?view=azure-bot-service-4.0)
2222
- knowledge of bot [Managing state](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-concept-state?view=azure-bot-service-4.0)
2323
- Download and install [ngrok](https://ngrok.com/) (if you want to debug a bot configured in Azure to use additional channels)
@@ -40,7 +40,7 @@ Then you need to update the code of your JavaScript bot as follows. You can read
4040

4141
**index.js**
4242

43-
Set up the inspection state and add the InspectionMiddleware to the adapter in the **index.js** file.
43+
Set up the inspection state and add the inspection middleware to the adapter in the **index.js** file.
4444

4545
[!code-javascript [inspection bot sample](~/../botbuilder-samples/samples/javascript_nodejs/47.inspection/index.js?range=10-43)]
4646

@@ -51,7 +51,7 @@ Update the bot class in the **bot.js** file.
5151
[!code-javascript [inspection bot sample](~/../botbuilder-samples/samples/javascript_nodejs/47.inspection/bot.js?range=6-50)]
5252

5353
# [C#](#tab/csharp)
54-
Set up the inspection state in the **Startup** file. Add the InspectionMiddleware to the adapter. The inspection state is provided through dependency injection. See the code update below or refer to the inspection sample here: [C#](https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/47.inspection).
54+
Set up the inspection state in the **Startup** file. Add the inspection middleware to the adapter. The inspection state is provided through dependency injection. See the code update below or refer to the inspection sample here: [C#](https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/47.inspection).
5555

5656
**Startup.cs**
5757
[!code-csharp [inspection bot sample](~/../botbuilder-samples/samples/csharp_dotnetcore/47.inspection/Startup.cs?range=17-37)]
@@ -86,10 +86,10 @@ dotnet run
8686

8787
3. Now open another emulator. This second emulator will work as a debugger. Follow the instructions as described in the previous step. Check **Open in debug mode** and then click **Connect**.
8888

89-
4. At this point you will see a UUID ( /INSPECT attach< identifier>) in your debugging emulator. Copy the UUID and paste it to the chat box of the first emulator.
89+
4. At this point you will see a UUID (`/INSPECT attach <identifier>`) in your debugging emulator. Copy the UUID and paste it to the chat box of the first emulator.
9090

91-
> ![NOTE]
92-
> A universally unique identifier (UUID) is a unique ID for identifying information. A UUID is generated every time the emulator is launched in debug mode. The format of an UUID here looks like this: /INSPECT attach< identifier>.
91+
> [!NOTE]
92+
> A universally unique identifier (UUID) is a unique ID for identifying information. A UUID is generated every time when the emulator is launched in debug mode after you add the inspection middleware in your bot's code.
9393
9494
5. Now you can send messages in the chat box of your first emulator and inspect the messages in the debugging emulator. To inspect the state of the messages click **Bot State** in the debugging emulator and unfold **values** on the right **JSON** window. You will be able to see the state of your bot as follows:
9595
![bot state](./media/bot-debug-inspection-middleware/bot-debug-bot-state.png)
@@ -103,7 +103,7 @@ At this point you have updated your emulator to the latest version and added the
103103
To run your bot locally do the following:
104104
1. Navigate to your bot's folder in a terminal and set your npm registration to use the [latest builds](https://botbuilder.myget.org/feed/botbuilder-v4-js-daily/package/npm/botbuilder-azure)
105105

106-
2. Run your bot locally. You will see your bot expose a port number like **3978**.
106+
2. Run your bot locally. You will see your bot expose a port number like 3978.
107107

108108
3. Open another command prompt and navigate to your bot's project folder. Run the following command:
109109
```
@@ -130,9 +130,9 @@ Now that your local bot is connected to ngrok you can configure your local bot t
130130

131131
5. Now let's enable the debugging mode in the emulator. In your emulator select **Debug** -> **Start Debugging**. Fill the ngrok IP address (don't forget to add **/api/messages**) in the **Bot URL** (for example, https://e58549b6.ngrok.io/api/messages). Fill **Microsoft App ID** with **appId** and **Microsoft App password** with **appSecret**. Make sure **Open in debug mode** is checked as well. Click **Connect**.
132132

133-
6. When the debugging mode is enabled a UUID will be generated in your emulator. A UUID is a unique ID generated every time you start the debugging mode in your emulator. Copy and paste the UUID to the **Test in Web Chat** chat box or your channel's chat box. You will see the message **Attached to session, all traffic is being replicated for inspection** in the chat box.
133+
6. When the debugging mode is enabled a UUID will be generated in your emulator. A UUID is a unique ID generated every time you start the debugging mode in your emulator. Copy and paste the UUID to the **Test in Web Chat** chat box or your channel's chat box. You will see the message "Attached to session, all traffic is being replicated for inspection" in the chat box.
134134

135-
You can start debugging your bot by sending messages in the configured channel's chat box. Your local emulator will automatically update the messages with all the details for debugging. To inspect your bot's state of messages click **Bot State** and unfold the **values** in right json window.
135+
You can start debugging your bot by sending messages in the configured channel's chat box. Your local emulator will automatically update the messages with all the details for debugging. To inspect your bot's state of messages click **Bot State** and unfold the **values** in the right JSON window.
136136

137137
![debug-inspection-middleware](./media/bot-debug-inspection-middleware/debug-state-inspection-channel-chat.gif)
138138

articles/v4sdk/bot-builder-telemetry.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Add telemetry to your bot | Microsoft Docs
33
description: Learn how to integrate your bot with the new telemetry features.
44
keywords: telemetry, appinsights, monitor bot
5-
author: ivorb
5+
author: WashingtonKayaker
66
ms.author: v-ivorb
77
manager: kamrani
88
ms.topic: article
@@ -309,7 +309,7 @@ There, you'll see some default information about your bot performance and any ad
309309

310310
## Additional Information
311311

312-
* [What is Application Insights?](https://aka.ms/bot-framework-emulator-appsights-docs)
312+
* [What is Application Insights?](https://aka.ms/appinsights-overview)
313313
314314
* [Using Search in Application Insights](https://aka.ms/search-in-application-insights)
315315

articles/v4sdk/migration/javascript-migration-quickreference.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,3 +403,28 @@ await context.sendActivity({
403403
attachmentLayout: AttachmentLayoutTypes.Carousel
404404
});
405405
```
406+
407+
## To use natural language recognition (LUIS)
408+
409+
### v3
410+
411+
```javascript
412+
// The LUIS recognizer was part of the 'botbuilder' library
413+
var builder = require('botbuilder');
414+
415+
var recognizer = new builder.LuisRecognizer(LUIS_MODEL_URL);
416+
bot.recognizer(recognizer);
417+
```
418+
419+
### v4
420+
421+
```javascript
422+
// The LUIS recognizer is now part of the 'botbuilder-ai' library
423+
const { LuisRecognizer } = require('botbuilder-ai');
424+
425+
const luisApp = { applicationId: LuisAppId, endpointKey: LuisAPIKey, endpoint: `https://${ LuisAPIHostName }` };
426+
const recognizer = new LuisRecognizer(luisApp);
427+
428+
const recognizerResult = await recognizer.recognize(context);
429+
const intent = LuisRecognizer.topIntent(recognizerResult);
430+
```

articles/v4sdk/migration/net-migration-quickreference.md

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,4 +557,61 @@ services.AddSingleton(conversationState);
557557

558558
### v4
559559

560-
[Bot.Builder.Community.Dialogs.Luis](https://www.nuget.org/packages/Bot.Builder.Community.Dialogs.Luis/) is now a Bot Builder Community library. The source is available on the community [repository](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/develop/libraries/Bot.Builder.Community.Dialogs.Luis).
560+
[Bot.Builder.Community.Dialogs.Luis](https://www.nuget.org/packages/Bot.Builder.Community.Dialogs.Luis/) is now a Bot Builder Community library. The source is available on the community [repository](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/develop/libraries/Bot.Builder.Community.Dialogs.Luis).
561+
562+
## To use QnA Maker
563+
564+
### v3
565+
566+
```csharp
567+
[Serializable]
568+
[QnAMaker("QnAEndpointKey", "QnAKnowledgebaseId", <ScoreThreshold>, <TotalResults>, "QnAEndpointHostName")]
569+
public class SimpleQnADialog : QnAMakerDialog
570+
{
571+
}
572+
```
573+
574+
### v4
575+
576+
```csharp
577+
public class QnABot : ActivityHandler
578+
{
579+
private readonly IConfiguration _configuration;
580+
private readonly ILogger<QnABot> _logger;
581+
private readonly IHttpClientFactory _httpClientFactory;
582+
583+
public QnABot(IConfiguration configuration, ILogger<QnABot> logger, IHttpClientFactory httpClientFactory)
584+
{
585+
_configuration = configuration;
586+
_logger = logger;
587+
_httpClientFactory = httpClientFactory;
588+
}
589+
590+
protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
591+
{
592+
var httpClient = _httpClientFactory.CreateClient();
593+
594+
var qnaMaker = new QnAMaker(new QnAMakerEndpoint
595+
{
596+
KnowledgeBaseId = _configuration["QnAKnowledgebaseId"],
597+
EndpointKey = _configuration["QnAEndpointKey"],
598+
Host = _configuration["QnAEndpointHostName"]
599+
},
600+
null,
601+
httpClient);
602+
603+
_logger.LogInformation("Calling QnA Maker");
604+
605+
// The actual call to the QnA Maker service.
606+
var response = await qnaMaker.GetAnswersAsync(turnContext);
607+
if (response != null && response.Length > 0)
608+
{
609+
await turnContext.SendActivityAsync(MessageFactory.Text(response[0].Answer), cancellationToken);
610+
}
611+
else
612+
{
613+
await turnContext.SendActivityAsync(MessageFactory.Text("No QnA Maker answers were found."), cancellationToken);
614+
}
615+
}
616+
}
617+
```

0 commit comments

Comments
 (0)