You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: "Tutorial: Language Understanding Bot Node.js v4"
3
-
titleSuffix: Azure Cognitive Services
2
+
title: "Tutorial: Language Understanding Bot Node.js v4"
4
3
description: Using Node.js, build a chat bot integrated with language understanding (LUIS) in this tutorial. This chat bot uses the Human Resources app to quickly implement a bot solution. The bot is built with the Bot Framework version 4 and the Azure Web app bot.
5
-
services: cognitive-services
6
-
author: diberry
7
-
ms.custom: seodec18
8
-
manager: nitinme
9
-
ms.service: cognitive-services
10
-
ms.subservice: language-understanding
11
4
ms.topic: tutorial
12
-
ms.date: 10/14/2019
13
-
ms.author: diberry
5
+
ms.date: 02/03/2020
14
6
---
15
7
16
-
# Tutorial: Use a Web App Bot enabled with Language Understanding in Node.js
8
+
# Tutorial: Use a Web App Bot enabled with Language Understanding in Node.js
17
9
18
10
Use Node.js to build a chat bot integrated with language understanding (LUIS). The bot is built with the Azure [Web app bot](https://docs.microsoft.com/azure/bot-service/) resource and [Bot Framework version](https://github.com/Microsoft/botbuilder-dotnet) V4.
19
11
20
-
[!INCLUDE [Waiting for Bot refresh](./includes/wait-bot-upgrade.md)]
21
-
22
12
**In this tutorial, you learn how to:**
23
13
24
14
> [!div class="checklist"]
@@ -62,16 +52,17 @@ Use Node.js to build a chat bot integrated with language understanding (LUIS). T
62
52
|SDK version|Bot framework version|**SDK v4**|
63
53
|SDK language|Programming language of bot|**Node.js**|
64
54
|Bot|Type of bot|**Basic bot**|
65
-
55
+
66
56
1. Select **Create**. This creates and deploys the bot service to Azure. Part of this process creates a LUIS app named `luis-nodejs-bot-XXXX`. This name is based on the /Azure Bot Service app name.
67
57
68
-
[](./media/bfv4-nodejs/create-web-app-service.png#lightbox)
58
+
> [!div class="mx-imgBorder"]
59
+
> [](./media/bfv4-nodejs/create-web-app-service.png#lightbox)
69
60
70
61
Wait until the bot service is created before continuing.
71
62
72
63
## The bot has a Language Understanding model
73
64
74
-
The bot service creation process also creates a new LUIS app with intents and example utterances. The bot provides intent mapping to the new LUIS app for the following intents:
65
+
The bot service creation process also creates a new LUIS app with intents and example utterances. The bot provides intent mapping to the new LUIS app for the following intents:
75
66
76
67
|Basic bot LUIS intents|example utterance|
77
68
|--|--|
@@ -82,31 +73,31 @@ The bot service creation process also creates a new LUIS app with intents and ex
82
73
83
74
## Test the bot in Web Chat
84
75
85
-
1. While still in the Azure portal for the new bot, select **Test in Web Chat**.
86
-
1. In the **Type your message** textbox, enter the text `Book a flight from Seattle to Berlin tomorrow`. The bot responds with verification that you want to book a flight.
76
+
1. While still in the Azure portal for the new bot, select **Test in Web Chat**.
77
+
1. In the **Type your message** textbox, enter the text `Book a flight from Seattle to Berlin tomorrow`. The bot responds with verification that you want to book a flight.
87
78
88
79

89
80
90
-
You can use the test functionality to quickly testing your bot. For more complete testing, including debugging, download the bot code and use Visual Studio.
81
+
You can use the test functionality to quickly testing your bot. For more complete testing, including debugging, download the bot code and use Visual Studio.
91
82
92
83
## Download the web app bot source code
93
-
In order to develop the web app bot code, download the code and use on your local computer.
84
+
In order to develop the web app bot code, download the code and use on your local computer.
94
85
95
-
1. In the Azure portal, select **Build** from the **Bot management** section.
86
+
1. In the Azure portal, select **Build** from the **Bot management** section.
96
87
97
-
1. Select **Download Bot source code**.
88
+
1. Select **Download Bot source code**.
98
89
99
90
[](../../../includes/media/cognitive-services-luis/bfv4/download-code.png#lightbox)
100
91
101
-
1. When the pop-up dialog asks **Include app settings in the downloaded zip file?**, select **Yes**. This provides the LUIS settings.
92
+
1. When the pop-up dialog asks **Include app settings in the downloaded zip file?**, select **Yes**. This provides the LUIS settings.
102
93
103
-
1. When the source code is zipped, a message will provide a link to download the code. Select the link.
94
+
1. When the source code is zipped, a message will provide a link to download the code. Select the link.
104
95
105
-
1. Save the zip file to your local computer and extract the files. Open the project with Visual Studio.
96
+
1. Save the zip file to your local computer and extract the files. Open the project with Visual Studio.
106
97
107
98
## Review code to send utterance to LUIS and get response
108
99
109
-
1. To send the user utterance to the LUIS prediction endpoint, open the **dialogs -> flightBookingRecognizer.js** file. This is where the user utterance entered into the bot is sent to LUIS. The response from LUIS is returned from the **executeLuisQuery** method.
100
+
1. To send the user utterance to the LUIS prediction endpoint, open the **dialogs -> flightBookingRecognizer.js** file. This is where the user utterance entered into the bot is sent to LUIS. The response from LUIS is returned from the **executeLuisQuery** method.
110
101
111
102
````javascript
112
103
classFlightBookingRecognizer {
@@ -130,64 +121,72 @@ In order to develop the web app bot code, download the code and use on your loca
130
121
131
122
132
123
````javascript
133
-
classMainDialogextendsComponentDialog {
124
+
// Copyright (c) Microsoft Corporation. All rights reserved.
constdidntUnderstandMessageText=`Sorry, I didn't get that. Please try asking in a different way (intent was ${LuisRecognizer.topIntent(luisResult) })`;
@@ -203,7 +202,7 @@ Ask bot a question for the Book Flight intent.
203
202
204
203
[](./media/bfv4-nodejs/ask-bot-emulator-a-question-and-get-response.png#lightbox)
205
204
206
-
1. Select **Yes**. The bot responds with a summary of its actions.
205
+
1. Select **Yes**. The bot responds with a summary of its actions.
207
206
1. From the log of the bot emulator, select the line that includes `Luis Trace`. This displays the JSON response from LUISfor the intent and entities of the utterance.
208
207
209
208
[](./media/bfv4-nodejs/ask-luis-book-flight-question-get-json-response-in-bot-emulator.png#lightbox)
@@ -213,7 +212,7 @@ Ask bot a question for the Book Flight intent.
213
212
214
213
## Next steps
215
214
216
-
See more [samples](https://github.com/microsoft/botframework-solutions) with conversational bots.
215
+
See more [samples](https://github.com/microsoft/botframework-solutions) with conversational bots.
217
216
218
217
> [!div class="nextstepaction"]
219
218
> [Build a Language Understanding app with a custom subject domain](luis-quickstart-intents-only.md)
0 commit comments