Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates DialogManager to work with skills #3709

Merged
merged 4 commits into from
Apr 13, 2020

Conversation

gabog
Copy link
Contributor

@gabog gabog commented Apr 8, 2020

Fixes #3657

This PR includes the following changes:

  • Updated DialogManager to handle skill requests (in addition to parent bot requests). This includes:
    • Handling regular activities sent from the parent.
    • Handling EoC sent from the parent.
    • Handling a RePrompt event sent from the parent.
  • Added unit tests.
  • Added end to end Parent->Skill sample with DialogManager for testing (under FunctionalTests\Skills\Adaptive).
  • Updated code in DialogManager and DialogManagerTests to follow SDK coding style conventions.

I also refactored DialogManager OnTurnAsync in a couple of private methods to split the Skill/Parent processing logic and reduce duplication.

…bot requests).

Added unit tests.
Added end to end Parent->Skill sample with DialogManager for testing.
@gabog gabog added Skills R9 Release 9 - May 15th, 2020 labels Apr 8, 2020
var snapshotDc = dc;
while (snapshotDc.Child != null)
var snapshot = GetActiveDialogContext(dc).State.GetMemorySnapshot();
var traceActivity = (Activity)Activity.CreateTraceActivity("BotState", "https://www.botframework.com/schemas/botState", snapshot, traceLabel);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sending bot state traces somewhere else in the sdk? If yes it might be worth to unify the code and define constants for the strings. If not, are there other places where we'd want to reuse this? Basically suggest to spend a few minutes thinking of potential reuse of this and if there is potential, expose it in a way that can be consumed by other parts of the SDK rather than requiring a refactor to do so. If this seems very specific to DialogManager to you, then a private method, as-is would be ok and no action required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using traces in other parts parts of the framework but I am just preserving the traces that were there before the refactoring, can we address the standarization of traces this as an R10 task? (I wouldn't want to go and refactor code that is not relevant to DialogManager at this point).

if (turnResult.Status == DialogTurnStatus.Complete || turnResult.Status == DialogTurnStatus.Cancelled)
{
var endMessageText = $"Dialog {_rootDialogId} has **completed**. Sending EndOfConversation.";
await turnContext.TraceActivityAsync($"{typeof(Dialog).Name}.RunAsync()", label: $"{endMessageText}", value: turnResult.Result, cancellationToken: cancellationToken).ConfigureAwait(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if they've already sent an EndOfConversation? I would setup a listner to detect that they sent an EOC and only send one yourself if they haven't

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any samples on how to setup a listener? I am not familiar with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Stevenic, I've been thinking about this, in what cases a dev would send an EoC by hand? Wouldn't that be a bug in their code?

Copy link
Contributor

@Stevenic Stevenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

@Stevenic Stevenic dismissed their stale review April 8, 2020 22:07

revoking review

Copy link
Contributor

@cleemullins cleemullins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LEt's get this in. We can then focus on:

  1. Remaining feedback treated as Issues
  2. Finalzing where/how the Functional Tests live.
  3. Unblocking JS if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R9 Release 9 - May 15th, 2020
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update DialogManager to work with Skills (dotnet)
6 participants