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

Commit 499c273

Browse files
authored
use Handoff instead of EndOfConversation to signal completion of skill dialog (#2244)
1 parent ad473bb commit 499c273

File tree

30 files changed

+46
-126
lines changed

30 files changed

+46
-126
lines changed

lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillCallingRequestHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public SkillCallingRequestHandler(
7575
throw new ArgumentNullException("FallbackRequestHandler", "Skill is asking for fallback but there is no handler on the calling side!");
7676
}
7777
}
78-
else if (activity.Type == ActivityTypes.EndOfConversation)
78+
else if (activity.Type == ActivityTypes.Handoff)
7979
{
8080
var result = await _turnContext.SendActivityAsync(activity).ConfigureAwait(false);
8181
if (_handoffActivityHandler != null)

lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillDialog.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,12 @@ private async Task<DialogTurnResult> ForwardToSkillAsync(DialogContext innerDc,
318318
{
319319
try
320320
{
321-
var endOfConversationActivity = await _skillTransport.ForwardToSkillAsync(_skillManifest, _serviceClientCredentials, innerDc.Context, activity, GetTokenRequestCallback(innerDc), GetFallbackCallback(innerDc));
321+
var handoffActivity = await _skillTransport.ForwardToSkillAsync(_skillManifest, _serviceClientCredentials, innerDc.Context, activity, GetTokenRequestCallback(innerDc), GetFallbackCallback(innerDc));
322322

323-
if (endOfConversationActivity != null)
323+
if (handoffActivity != null)
324324
{
325325
await innerDc.Context.SendActivityAsync(new Activity(type: ActivityTypes.Trace, text: $"<--Ending the skill conversation with the {_skillManifest.Name} Skill and handing off to Parent Bot."));
326-
return await innerDc.EndDialogAsync(endOfConversationActivity.SemanticAction?.Entities);
326+
return await innerDc.EndDialogAsync(handoffActivity.SemanticAction?.Entities);
327327
}
328328
else if (_authDialogCancelled)
329329
{

lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillWebSocketBotAdapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ private void EnsureActivitySemanticAction(ITurnContext turnContext, Activity act
272272
activity.SemanticAction = turnContext.Activity.SemanticAction;
273273
}
274274

275-
if (activity.Type == ActivityTypes.EndOfConversation)
275+
if (activity.Type == ActivityTypes.Handoff)
276276
{
277277
activity.SemanticAction.State = SkillConstants.SkillDone;
278278
}

lib/csharp/microsoft.bot.builder.skills/Microsoft.Bot.Builder.Skills/SkillWebSocketTransport.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class SkillWebSocketTransport : ISkillTransport
1919
{
2020
private IStreamingTransportClient _streamingTransportClient;
2121
private readonly IBotTelemetryClient _botTelemetryClient;
22-
private Activity endOfConversationActivity;
22+
private Activity _handoffActivity;
2323

2424
public SkillWebSocketTransport(
2525
IBotTelemetryClient botTelemetryClient,
@@ -85,7 +85,7 @@ public async Task<Activity> ForwardToSkillAsync(SkillManifest skillManifest, ISe
8585
{ "Latency", stopWatch.ElapsedMilliseconds },
8686
});
8787

88-
return endOfConversationActivity;
88+
return _handoffActivity;
8989
}
9090

9191
public async Task CancelRemoteDialogsAsync(SkillManifest skillManifest, IServiceClientCredentials appCredentials, ITurnContext turnContext)
@@ -126,7 +126,7 @@ private Action<Activity> GetHandoffActivityCallback()
126126
{
127127
return (activity) =>
128128
{
129-
endOfConversationActivity = activity;
129+
_handoffActivity = activity;
130130
};
131131
}
132132

skills/src/csharp/automotiveskill/automotiveskill/Dialogs/MainDialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public MainDialog(
121121
if (dc.Context.Adapter is IRemoteUserTokenProvider remoteInvocationAdapter || Channel.GetChannelId(dc.Context) != Channels.Msteams)
122122
{
123123
var response = dc.Context.Activity.CreateReply();
124-
response.Type = ActivityTypes.EndOfConversation;
124+
response.Type = ActivityTypes.Handoff;
125125

126126
await dc.Context.SendActivityAsync(response);
127127
}

skills/src/csharp/automotiveskill/automotiveskilltest/Flow/VehicleSettingsTests.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ await this.GetTestFlow()
104104
IsConfirmed = true,
105105
}))
106106
.AssertReply(this.CheckReply("Setting Lane Change Detection to Off."))
107-
.AssertReply(this.CheckForEndOfConversation())
107+
.AssertReply(this.CheckForHandoff())
108108
.StartTestAsync();
109109
}
110110

@@ -116,7 +116,7 @@ await this.GetTestFlow()
116116
.AssertReply(this.CheckReply("So, you want to change Lane Change Detection to Off. Is that correct? (1) Yes or (2) No"))
117117
.Send("no")
118118
.AssertReply(this.CheckReply("Ok, not making any changes."))
119-
.AssertReply(this.CheckForEndOfConversation())
119+
.AssertReply(this.CheckForHandoff())
120120
.StartTestAsync();
121121
}
122122

@@ -332,12 +332,11 @@ private Action<IActivity> CheckForSettingEvent(SettingChange expectedChange)
332332
};
333333
}
334334

335-
private Action<IActivity> CheckForEndOfConversation()
335+
private Action<IActivity> CheckForHandoff()
336336
{
337337
return activity =>
338338
{
339-
var eventReceived = activity.AsEndOfConversationActivity();
340-
Assert.IsNotNull(eventReceived, "End of Conversation Activity not received.");
339+
Assert.AreEqual(activity.Type, ActivityTypes.Handoff, "End of Conversation Activity not received.");
341340
};
342341
}
343342

skills/src/csharp/calendarskill/calendarskill/Dialogs/MainDialog.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ private async Task PopulateStateFromSemanticAction(ITurnContext context)
221221
if (dc.Context.Adapter is IRemoteUserTokenProvider remoteInvocationAdapter || Channel.GetChannelId(dc.Context) != Channels.Msteams)
222222
{
223223
var response = dc.Context.Activity.CreateReply();
224-
response.Type = ActivityTypes.EndOfConversation;
224+
response.Type = ActivityTypes.Handoff;
225225

226226
await dc.Context.SendActivityAsync(response);
227227
}
@@ -244,7 +244,7 @@ private async Task PopulateStateFromSemanticAction(ITurnContext context)
244244
if (result.Status != DialogTurnStatus.Waiting)
245245
{
246246
var response = dc.Context.Activity.CreateReply();
247-
response.Type = ActivityTypes.EndOfConversation;
247+
response.Type = ActivityTypes.Handoff;
248248

249249
await dc.Context.SendActivityAsync(response);
250250
}

skills/src/csharp/calendarskill/calendarskilltest/Flow/ConnectToMeetingFlowTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private Action<IActivity> ActionEndMessage()
6060
{
6161
return activity =>
6262
{
63-
Assert.AreEqual(activity.Type, ActivityTypes.EndOfConversation);
63+
Assert.AreEqual(activity.Type, ActivityTypes.Handoff);
6464
};
6565
}
6666
}

skills/src/csharp/calendarskill/calendarskilltest/Flow/CreateCalendarFlowTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ private Action<IActivity> ActionEndMessage()
758758
{
759759
return activity =>
760760
{
761-
Assert.AreEqual(activity.Type, ActivityTypes.EndOfConversation);
761+
Assert.AreEqual(activity.Type, ActivityTypes.Handoff);
762762
};
763763
}
764764

skills/src/csharp/calendarskill/calendarskilltest/Flow/DeleteCalendarFlowTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private Action<IActivity> ActionEndMessage()
151151
{
152152
return activity =>
153153
{
154-
Assert.AreEqual(activity.Type, ActivityTypes.EndOfConversation);
154+
Assert.AreEqual(activity.Type, ActivityTypes.Handoff);
155155
};
156156
}
157157
}

0 commit comments

Comments
 (0)