Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Commit 219034c

Browse files
gabogArsh-KashyaptracyboehrerJonathanFingoldeberhardts
authored
Update samples to 4.16 (#3734)
* Added CustomQABot and CustomQABotAllFeatures. (#3712) * Added CustomQABot and CustomQABotAllFeatures. * Updated configuration and removed model. * Readme Updated. * Readme heading updated. * Models added and code refactored. * Readme updated * Readme updated. * Updated Readme and renamed bot. * Readme updated * Readme updated. * Updated readme. * Updated .csproj and .sln * Refactored code and comments added. * Minor comment change. * Addressed review comments and updated Readme. * Updated Readme. * Updated Readme. * Updated Readme. * Updated configuration names in appsettings.json. * Renamed default.htm to default.html * Updated Readme. * Code refactored and readme updated. * Reduced references in readme. * Changed cognitiveModel file name. * Updated ArgumentException for configuration. * Updated ArgumentException for configuration * Updated readme and refactored code. * Added CustomQABot and CustomQABotAllFeatures (#3716) * Added CustomQABot and CustomQABotAllFeatures. * Updated .env file. * Updated folder names. * Added more functionality. * Updated configuration names in .env. * Used enum for qnaServiceType. * Removed null check from index.js * Updated Readme of both samples and added eslintrc * Removed Typos from Readme. (#3733) * Removed Typos from Readme. * Updated line no. for filters. * Changed card references to rootDialog.js * Added link to rootDialog * Updated Readme. * Updated JS dependency version for BF * Updated BF sdk references to 4.16.0 Consolidated timex expressions references to 1.7.0 Consolidated newtonsoft references to 3.1.1 * Updated old QnAamples readmes with deprecation notice * Fixed links * Updated JS readmes * Update samples/csharp_dotnetcore/11.qnamaker/README.md Co-authored-by: Jonathan Fingold <jonathan.m.fingold@gmail.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Jonathan Fingold <jonathan.m.fingold@gmail.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Jonathan Fingold <jonathan.m.fingold@gmail.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Jonathan Fingold <jonathan.m.fingold@gmail.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Jonathan Fingold <jonathan.m.fingold@gmail.com> * Update samples/csharp_dotnetcore/11.qnamaker/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Jonathan Fingold <jonathan.m.fingold@gmail.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Jonathan Fingold <jonathan.m.fingold@gmail.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Jonathan Fingold <jonathan.m.fingold@gmail.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Jonathan Fingold <jonathan.m.fingold@gmail.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/12.customQABot/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Update samples/csharp_dotnetcore/48.customQABot-all-features/README.md Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com> * Addressed Jonathan's feedback * Updated JS readmne for js sample 12 to match donet sample * Updated readme to match dotnet readme * Updated JS readme for sample 49 to align C# readme Co-authored-by: Arsh Kashyap <60098300+Arsh-Kashyap@users.noreply.github.com> Co-authored-by: tracyboehrer <tracyboehrer@users.noreply.github.com> Co-authored-by: Jonathan Fingold <jonathan.m.fingold@gmail.com> Co-authored-by: Sarah Eberhardt <94552194+eberhardts@users.noreply.github.com>
1 parent b51d79f commit 219034c

145 files changed

Lines changed: 5985 additions & 166 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

samples/csharp_dotnetcore/01.console-echo/Console-EchoBot.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
12-
<PackageReference Include="Microsoft.Bot.Builder" Version="4.15.2" />
13-
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.15.2" />
12+
<PackageReference Include="Microsoft.Bot.Builder" Version="4.16.0" />
13+
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.16.0" />
1414
</ItemGroup>
1515

1616
</Project>

samples/csharp_dotnetcore/02.echo-bot/EchoBot.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<ItemGroup>
99
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
10-
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.15.2" />
10+
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.16.0" />
1111
</ItemGroup>
1212

1313
<ItemGroup>

samples/csharp_dotnetcore/03.welcome-user/WelcomeUser.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77
<ItemGroup>
88
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
9-
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.15.2" />
9+
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.16.0" />
1010
</ItemGroup>
1111

1212
<ItemGroup>

samples/csharp_dotnetcore/05.multi-turn-prompt/MultiTurnPromptBot.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
<ItemGroup>
99
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
10-
<PackageReference Include="Microsoft.Bot.Builder.Dialogs" Version="4.15.2" />
11-
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.15.2" />
10+
<PackageReference Include="Microsoft.Bot.Builder.Dialogs" Version="4.16.0" />
11+
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.16.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

samples/csharp_dotnetcore/06.using-cards/CardsBot.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
<ItemGroup>
99
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
10-
<PackageReference Include="Microsoft.Bot.Builder.Dialogs" Version="4.15.2" />
11-
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.15.2" />
10+
<PackageReference Include="Microsoft.Bot.Builder.Dialogs" Version="4.16.0" />
11+
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.16.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

samples/csharp_dotnetcore/07.using-adaptive-cards/AdaptiveCardsBot.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<ItemGroup>
99
<PackageReference Include="AdaptiveCards" Version="1.0.3" />
1010
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
11-
<PackageReference Include="Microsoft.Bot.Builder.Dialogs" Version="4.15.2" />
12-
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.15.2" />
11+
<PackageReference Include="Microsoft.Bot.Builder.Dialogs" Version="4.16.0" />
12+
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.16.0" />
1313
</ItemGroup>
1414

1515
<ItemGroup>

samples/csharp_dotnetcore/08.suggested-actions/SuggestedActionsBot.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<ItemGroup>
99
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
10-
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.15.2" />
10+
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.16.0" />
1111
</ItemGroup>
1212

1313
<ItemGroup>

samples/csharp_dotnetcore/11.qnamaker/QnABot.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
<ItemGroup>
99
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
10-
<PackageReference Include="Microsoft.Bot.Builder.AI.QnA" Version="4.15.2" />
11-
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.15.2" />
10+
<PackageReference Include="Microsoft.Bot.Builder.AI.QnA" Version="4.16.0" />
11+
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.16.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

samples/csharp_dotnetcore/11.qnamaker/README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# QnA Maker
22

3-
Bot Framework v4 QnA Maker bot sample
3+
**Important**: The QnA Maker service will retire on the 31st of March, 2025. A newer version of the question and answering capability is now available as part of Azure Cognitive Service for Language.
4+
For question-and-answer capabilities within the Cognitive Services, see _question answering_. Starting 1st October, 2022 you won’t be able to create new QnA Maker resources.
5+
For information on migrating existing QnA Maker knowledge bases to question answering, consult the migration guide.
6+
For an updated version of this sample that uses question answering, see the [CustomQABot sample](../12.customQABot).
47

5-
This bot has been created using [Bot Framework](https://dev.botframework.com), it shows how to create a bot that uses the [QnA Maker Cognitive AI](https://www.qnamaker.ai) service.
68

7-
The [QnA Maker Service](https://www.qnamaker.ai) enables you to build, train and publish a simple question and answer bot based on FAQ URLs, structured documents or editorial content in minutes. In this sample, we demonstrate how to use the QnA Maker service to answer questions based on a FAQ text file used as input.
9+
Bot Framework v4 QnA Maker bot sample: This bot has been created using [Bot Framework](https://dev.botframework.com), it shows how to create a bot that uses the [QnA Maker Cognitive AI](https://www.qnamaker.ai) service.
10+
11+
The [QnA Maker Service](https://www.qnamaker.ai) enables you to build, train, and publish a simple question and answer bot based on FAQ URLs, structured documents, or editorial content in minutes. In this sample, we demonstrate how to use the QnA Maker service to answer questions based on a FAQ text file used as input.
12+
813

914
## Prerequisites
1015

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System;
5+
using Microsoft.Bot.Builder;
6+
using Microsoft.Bot.Builder.Integration.AspNet.Core;
7+
using Microsoft.Bot.Builder.TraceExtensions;
8+
using Microsoft.Bot.Connector.Authentication;
9+
using Microsoft.Extensions.Logging;
10+
11+
namespace Microsoft.BotBuilderSamples
12+
{
13+
public class AdapterWithErrorHandler : CloudAdapter
14+
{
15+
public AdapterWithErrorHandler(BotFrameworkAuthentication auth, ILogger<IBotFrameworkHttpAdapter> logger, ConversationState conversationState = default)
16+
: base(auth, logger)
17+
{
18+
OnTurnError = async (turnContext, exception) =>
19+
{
20+
// Log any leaked exception from the application.
21+
// NOTE: In production environment, you should consider logging this to
22+
// Azure Application Insights. Visit https://aka.ms/bottelemetry to see how
23+
// to add telemetry capture to your bot.
24+
logger.LogError(exception, $"[OnTurnError] unhandled error : {exception.Message}");
25+
26+
// Send a message to the user
27+
await turnContext.SendActivityAsync("The bot encountered an error or bug.");
28+
await turnContext.SendActivityAsync("To continue to run this bot, please fix the bot source code.");
29+
30+
if (conversationState != null)
31+
{
32+
try
33+
{
34+
// Delete the conversationState for the current conversation to prevent the
35+
// bot from getting stuck in a error-loop caused by being in a bad state.
36+
// ConversationState should be thought of as similar to "cookie-state" in a Web pages.
37+
await conversationState.DeleteAsync(turnContext);
38+
}
39+
catch (Exception e)
40+
{
41+
logger.LogError(e, $"Exception caught on attempting to Delete ConversationState : {e.Message}");
42+
}
43+
}
44+
45+
// Send a trace activity, which will be displayed in the Bot Framework Emulator
46+
await turnContext.TraceActivityAsync("OnTurnError Trace", exception.Message, "https://www.botframework.com/schemas/error", "TurnError");
47+
};
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)