Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class DefaultSettingManager extends FileSettingManager {
feature: {
UseShowTypingMiddleware: false,
UseInspectionMiddleware: false,
RemoveRecipientMention: false,
},
MicrosoftAppPassword: '',
MicrosoftAppId: '',
Expand Down
5 changes: 4 additions & 1 deletion runtime/dotnet/azurefunctions/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ public override void Configure(IFunctionsHostBuilder builder)

var defaultLocale = rootConfiguration.GetValue<string>("defaultLocale") ?? "en-us";

var removeRecipientMention = settings?.Feature?.RemoveRecipientMention ?? false;

// Bot
services.AddSingleton<IBot>(s =>
new ComposerBot(
Expand All @@ -184,7 +186,8 @@ public override void Configure(IFunctionsHostBuilder builder)
s.GetService<SkillConversationIdFactoryBase>(),
s.GetService<IBotTelemetryClient>(),
GetRootDialog(Path.Combine(rootDirectory, settings.Bot)),
defaultLocale));
defaultLocale,
removeRecipientMention));
}

public void ConfigureTranscriptLoggerMiddleware(BotFrameworkHttpAdapter adapter, BotSettings settings)
Expand Down
5 changes: 4 additions & 1 deletion runtime/dotnet/azurewebapp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ public void ConfigureServices(IServiceCollection services)

services.AddSingleton<IBotFrameworkHttpAdapter, BotFrameworkHttpAdapter>((s) => GetBotAdapter(storage, settings, userState, conversationState, s, s.GetService<TelemetryInitializerMiddleware>()));

var removeRecipientMention = settings?.Feature?.RemoveRecipientMention ?? false;

services.AddSingleton<IBot>(s =>
new ComposerBot(
s.GetService<ConversationState>(),
Expand All @@ -186,7 +188,8 @@ public void ConfigureServices(IServiceCollection services)
s.GetService<SkillConversationIdFactoryBase>(),
s.GetService<IBotTelemetryClient>(),
rootDialog,
defaultLocale));
defaultLocale,
removeRecipientMention));
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Expand Down
10 changes: 9 additions & 1 deletion runtime/dotnet/core/ComposerBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Microsoft.Bot.Builder.Dialogs.Declarative.Resources;
using Microsoft.Bot.Builder.Skills;
using Microsoft.Bot.Connector.Authentication;
using Microsoft.Bot.Schema;

namespace Microsoft.BotFramework.Composer.Core
{
Expand All @@ -26,8 +27,9 @@ public class ComposerBot : ActivityHandler
private readonly string rootDialogFile;
private readonly IBotTelemetryClient telemetryClient;
private readonly string defaultLocale;
private readonly bool removeRecipientMention;

public ComposerBot(ConversationState conversationState, UserState userState, ResourceExplorer resourceExplorer, BotFrameworkClient skillClient, SkillConversationIdFactoryBase conversationIdFactory, IBotTelemetryClient telemetryClient, string rootDialog, string defaultLocale)
public ComposerBot(ConversationState conversationState, UserState userState, ResourceExplorer resourceExplorer, BotFrameworkClient skillClient, SkillConversationIdFactoryBase conversationIdFactory, IBotTelemetryClient telemetryClient, string rootDialog, string defaultLocale, bool removeRecipientMention = false)
{
this.conversationState = conversationState;
this.userState = userState;
Expand All @@ -36,6 +38,7 @@ public ComposerBot(ConversationState conversationState, UserState userState, Res
this.rootDialogFile = rootDialog;
this.defaultLocale = defaultLocale;
this.telemetryClient = telemetryClient;
this.removeRecipientMention = removeRecipientMention;

LoadRootDialogAsync();
this.dialogManager.InitialTurnState.Set(skillClient);
Expand All @@ -54,6 +57,11 @@ public ComposerBot(ConversationState conversationState, UserState userState, Res
rootDialog.AutoEndDialog = false;
}

if (this.removeRecipientMention && turnContext?.Activity?.Type == "message")
{
turnContext.Activity.RemoveRecipientMention();
}

await this.dialogManager.OnTurnAsync(turnContext, cancellationToken: cancellationToken);
await this.conversationState.SaveChangesAsync(turnContext, false, cancellationToken);
await this.userState.SaveChangesAsync(turnContext, false, cancellationToken);
Expand Down
3 changes: 3 additions & 0 deletions runtime/dotnet/core/Settings/BotFeatureSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ public class BotFeatureSettings

// Use InspectionMiddleware
public bool UseInspectionMiddleware { get; set; }

// Use RemoveRecipientMention Activity Extensions
public bool RemoveRecipientMention { get; set; }
}
}