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

Commit a2cf1e2

Browse files
authored
[Docs] Added activity flow doc (#2740)
* updated docs * Update 4-edit-your-cognitive-models.md
1 parent ec8b46c commit a2cf1e2

File tree

5 files changed

+64
-8
lines changed

5 files changed

+64
-8
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
category: Virtual Assistant
3+
subcategory: Handbook
4+
title: Activity Handling
5+
description: Manage routing incoming activities, including handling interruptions.
6+
order: 1
7+
toc: true
8+
---
9+
10+
# {{ page.title }}
11+
{:.no_toc}
12+
{{ page.description }}
13+
14+
## Introduction
15+
The Virtual Assistant provides foundational logic for handling incoming user activities. It uses a combination of concepts from the Bot Builder SDK v4 and base classes that enable additional scenarios.
16+
17+
## Adapters and Middleware
18+
Incoming activities are initially received through the BotAdapter implementation, processed through the configured Middleware pipeline, then routed onto the Assistant's dialog stack. The **DefaultAdapter** in the Virtual Assistant template provides a set of Middleware out of the box including the following:
19+
20+
- **Telemetry Middleware** - Configures Application Insights telemetry logging.
21+
- **Transcript Logger Middleware** - Configures conversation transcript logging.
22+
- **Show Typing Middleware** - Sends typing indicators from the bot.
23+
- **Feedback Middleware** - Configures the [Feedback]({{site.baseurl}}//virtual-assistant/feedback) feature.
24+
- **Set Locale Middleware** - Configures the CurrentUICulture to enable localization scenarios.
25+
- **Event Debugger Middleware** - Enables debugging for event activities.
26+
27+
## Activity Handler
28+
After the activity is processed by the Adapter and Middleware pipeline, it is received by the **ActivityHandler** implementation. The **DefaultActivityHandler** in the template implements the TeamsActivityHandler which enables Teams scenarios out of the box. By default, the **DefaultActivityHandler** passes the incoming message into the **MainDialog**. However, this logic can be customized as needed.
29+
30+
## Dialogs
31+
The **DefaultActivityHandler** passes incoming activities into the **MainDialog**. **MainDialog** implements the **ActivityHandlerDialog**, which provides its own routing logic for handling activities of different types, as well as enables interruptions. The following diagram shows how the activities flow through the different methods in **MainDialog**:
32+
33+
![]({{site.baseurl}}/assets/images/virtual-assistant-main-dialog-flow.png)
34+
35+
### Interruptions
36+
Once an activity flows into MainDialog, one of the first methods that will be called is OnInterruptDialogAsync(). The following interruptions are configured out of the box:
37+
- **Switching between Skills** - Switches between connected skills based on intent.
38+
- **Cancellation** - Cancels the current dialog.
39+
- **Help** - Sends a help message, then resumes the waiting dialog.
40+
- **Escalation** - Shows an escalation message.
41+
- **Log out** - Logs the user out.
42+
- **Repeat** - Repeats the last set of activities from the bot. Useful for speech scenarios.
43+
- **Start over** - Starts the current dialog over.
44+
- **Stop** - Can be implemented to stop readout in speech scenarios.
45+
46+
### Activity Routing
47+
Once interruptions are evaluated, the activity is processed according to its activity type:
48+
49+
- **OnMessageActivityAsync()** - Any incoming message activities that were not handled by a waiting dialog.
50+
- **OnMembersAddedAsync()** - Any incoming conversation update activity. Used for introduction logic.
51+
- **OnEventActivityAsync()** - Any incoming event activity
52+
- **OnUnhandledActivityTypeAsync()** - Any other incoming activity.

docs/_docs/virtual-assistant/handbook/feedback.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,6 @@ After the middleware is configured, you can request feedback as usual.
6060
## View your feedback in Power BI
6161
You can view your **Feedback** in the Feedback tab of the Conversational AI Dashboard.
6262

63-
[Learn how to set up your own Power BI dashboard]({{site.baseurl}}/virtual-assistant/tutorials/view-analytics/1-intro/)
63+
![]({{site.baseurl}}/assets/images/analytics/virtual-assistant-analytics-powerbi-13.png)
64+
65+
[Learn how to set up your own Power BI dashboard.]({{site.baseurl}}/solution-accelerators/tutorials/view-analytics/1-intro/)

docs/_docs/virtual-assistant/tutorials/customize-assistant/csharp/4-edit-your-cognitive-models.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,24 @@ order: 4
99

1010
# Tutorial: {{page.subcategory}} ({{page.language}})
1111

12-
## Update your knowledgebases
13-
The Virtual Assistant Template include two knowledgebases, FAQ and Chitchat, that can be customized to fit your scenario. For example, QnA Maker offers FAQ and PDF extraction to automatically build a knowledgebase from your existing content ([learn more](https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/concepts/data-sources-supported)). They also offer a variety of prebuilt chitchat knowledgebases with different personality types ([learn more](https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/how-to/chit-chat-knowledge-base)). Refer to this documentation to learn how to edit your knowledgebases in the QnA Maker portal: https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/how-to/edit-knowledge-base.
12+
## Update your knowledge bases
13+
The Virtual Assistant Template includes two knowledge bases, FAQ and Chitchat, that can be customized to fit your scenario. For example, QnA Maker offers FAQ and PDF extraction to automatically build a knowledge base from your existing content ([learn more](https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/concepts/data-sources-supported)).
14+
15+
There are also a variety of prebuilt chitchat knowledge bases with different personality types ([learn more](https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/how-to/chit-chat-knowledge-base)). Refer to this documentation to learn how to edit your knowledge bases in the QnA Maker portal: [How to edit a knowledgebase](https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/how-to/edit-knowledge-base).
1416

1517
Once you have made your desired changes, your Virtual Assistant Dispatch model will need to be updated with your changes. Run the following command from your project directory to update your Dispatch model:
1618
```
1719
.\Deployment\Scripts\update_cognitive_models.ps1 -RemoteToLocal
1820
```
1921
> This script updates your local .lu files with any changes in made in the QnA Maker or LUIS portals, then runs `dispatch refresh` to update your Dispatch model with the changes.
2022
21-
## Add an additional knowledgebase
23+
## Add an additional knowledge base
2224

2325
You may wish to add an additional [QnA Maker](https://www.qnamaker.ai/) knowledge base to your assistant, this can be performed through the following steps.
2426

25-
1. Create your new knowledge base using the QnAMaker portal. You can alternatively create this from a new `.lu` file by adding that file to the corresponding resource folder. For example, if you are using an English resource, you should place it in the `deployment/resources/QnA/en` folder. To understand how to create a knowledge base from a `.lu` file using the `ludown` and `qnamaker` CLI tools please refer to [this blog post](https://blog.botframework.com/2018/06/20/qnamaker-with-the-new-botbuilder-tools-for-local-development/) for more information.
27+
1. Create your new knowledge base using the QnAMaker portal. You can alternatively create this from a new `.lu` file by adding that file to the corresponding resource folder. For example, if you are using an English resource, you should place it in the `deployment/resources/QnA/en-us` folder. To understand how to create a knowledge base from a `.lu` file using the `ludown` and `qnamaker` CLI tools please refer to [this blog post](https://blog.botframework.com/2018/06/20/qnamaker-with-the-new-botbuilder-tools-for-local-development/) for more information.
2628

27-
3. Update the `cognitiveModels.json` file in the root of your project with a new entry for your newly created QnAMaker knowledgebase, an example is shown below:
29+
3. Update the `cognitiveModels.json` file in the root of your project with a new entry for your newly created QnA Maker knowledge base, an example is shown below:
2830

2931
```json
3032
{
@@ -37,7 +39,7 @@ You may wish to add an additional [QnA Maker](https://www.qnamaker.ai/) knowledg
3739
}
3840
```
3941

40-
The `kbID`, `hostName` and `endpoint key` can all be found within the **Publish** page on the [QnAMaker portal](https://qnamaker.ai). The subscription key is available from your QnA resource in the Azure Portal.
42+
The `kbID`, `hostName` and `endpoint key` can all be found within the **Publish** page on the [QnA Maker portal](https://qnamaker.ai). The subscription key is available from your QnA resource in the Azure Portal.
4143

4244
4. The final step is to update your dispatch model and associated strongly typed class (LuisGen). We have provided the `update_cognitive_models.ps1` script to simplify this for you. The optional `-RemoteToLocal` parameter will generate the matching LU file on disk for your new knowledgebase (if you created using portal). The script will then refresh the dispatcher.
4345

@@ -53,7 +55,7 @@ You can now leverage multiple QnA sources as a part of your assistant's knowledg
5355

5456
## Update your local LU files for LUIS and QnAMaker
5557

56-
As you build out your assistant you will likely update the LUIS models and QnAMaker knowledgebases for your Assistant in the respective portals. You'll then need to ensure the LU files representing your LUIS models in source control are kept up to date. We have provided the following script to refresh the local LU files for your project which is driven by the sources in your `cognitiveModels.json` file.
58+
As you build out your assistant you will likely update the LUIS models and QnA Maker knowledge bases for your Assistant in the respective portals. You'll then need to ensure the LU files representing your LUIS models in source control are kept up to date. We have provided the following script to refresh the local LU files for your project which is driven by the sources in your `cognitiveModels.json` file.
5759

5860
Run the following command from within Powershell (pwsh.exe) within your **project directory**.
5961

173 KB
Loading
37.4 KB
Loading

0 commit comments

Comments
 (0)