-
Notifications
You must be signed in to change notification settings - Fork 304
Axsuarez/skill dialog #757
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
Merged
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
fecc2f1
initial changes for skill dialog
axelsrz 2eec594
Skill dialog
axelsrz 800835b
Initial echo skill with dialog
axelsrz 6349deb
pylint: Initial echo skill with dialog
axelsrz 46018b4
Merge branch 'master' into axsuarez/skill-dialog
axelsrz f9b80dd
made integration package for aiohttp, dialog root bot for testing
axelsrz 91d7c6b
pylint: made integration package for aiohttp, dialog root bot for tes…
axelsrz 10117aa
pylint: made integration package for aiohttp, dialog root bot for tes…
axelsrz 05b46a0
Merge branch 'axsuarez/skill-dialog' of https://github.com/Microsoft/…
axelsrz 4a2ef03
pylint: made integration package for aiohttp, dialog root bot for tes…
axelsrz 0c92083
Initial dialog skill bot
axelsrz 9d95a3e
Changes to skill bot
axelsrz 8f3f55e
Merge branch 'master' into axsuarez/skill-dialog
tracyboehrer 31717c6
Merge branch 'master' of https://github.com/microsoft/botbuilder-pyth…
axelsrz 365541a
Updates for dialog interruption and buffered response. Pending to mov…
axelsrz 1a921fd
Relates to in post_activity in BotFrameworkHttpClient
axelsrz a5670c1
fix on BeginSkillDialogOptions
axelsrz 1561e2d
Moved SkillHttpClient to correct library with corresponding tests. Fi…
axelsrz a00b663
black: Moved SkillHttpClient to correct library with corresponding te…
axelsrz fe2ab2c
relative import fix
axelsrz 7f99434
Removed unused import
axelsrz 4703510
Modified TurnContext.send_trace_activity to default args.
tracyboehrer 7aabfe4
Removed argument checks that didn't exist in C#. Fixed bug in SkillD…
tracyboehrer f9976a1
Added initial SkillDialog unit test.
tracyboehrer c4e66d9
Added remainder of SkillDialog unit tests
tracyboehrer b0f4578
Solved conflicts w/ master
axelsrz 5f4323c
Merge branch 'axsuarez/skill-dialog' of https://github.com/microsoft/…
axelsrz 5bcfd10
Updates on dialog-root-bot
axelsrz 3e031c2
Updated buffered_replies to expect_replies
tracyboehrer 09cd3cc
Using HTTPStatus defines.
tracyboehrer bf059dc
Skill OAuth only change card action for emulator
tracyboehrer 97e691b
black
tracyboehrer 8e9c573
skill root bot updated
axelsrz c224ea7
skill root bot updated
axelsrz e2de13e
Merge branch 'axsuarez/skill-dialog' of https://github.com/microsoft/…
axelsrz d9a0b05
Removed old import in dialog root bot
axelsrz 91486b4
Dialog-to-dialog work
tracyboehrer 36afefc
Ummm... the actual dialog-to-dialog work
tracyboehrer ed0817a
Corrected dialog-skill-bot AcitivyRouterDialog to actually have a Wat…
tracyboehrer c8c3528
dialog-to-dialog test bot changes: dialog-echo-skill-bot, corrected m…
tracyboehrer 6b137f7
dialog-to-dialog: Handling messages with values (serialization and wh…
tracyboehrer d67e77d
Merge branch 'master' into axsuarez/skill-dialog
tracyboehrer f59e36f
Memory storage does not validate e_tag integrity anymore, following t…
axelsrz cc98985
Merge branch 'master' into axsuarez/skill-dialog
axelsrz edc2b02
pylint: Memory storage does not validate e_tag integrity anymore, fol…
axelsrz f293cd9
Merge branch 'axsuarez/skill-dialog' of https://github.com/microsoft/…
axelsrz dda4935
pylint: Memory storage does not validate e_tag integrity anymore, fol…
axelsrz c31fbd2
Removing samples from product code PR
axelsrz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
libraries/botbuilder-core/botbuilder/core/skills/bot_framework_client.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
|
|
||
| from abc import ABC | ||
|
|
||
| from botbuilder.schema import Activity | ||
| from botbuilder.core import InvokeResponse | ||
|
|
||
|
|
||
| class BotFrameworkClient(ABC): | ||
| def post_activity( | ||
| self, | ||
| from_bot_id: str, | ||
| to_bot_id: str, | ||
| to_url: str, | ||
| service_url: str, | ||
| conversation_id: str, | ||
| activity: Activity, | ||
| ) -> InvokeResponse: | ||
| raise NotImplementedError() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_events.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
|
|
||
| from enum import Enum | ||
|
|
||
|
|
||
| class DialogEvents(str, Enum): | ||
|
|
||
| begin_dialog = "beginDialog" | ||
| reprompt_dialog = "repromptDialog" | ||
| cancel_dialog = "cancelDialog" | ||
| activity_received = "activityReceived" | ||
| error = "error" |
77 changes: 77 additions & 0 deletions
77
libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_extensions.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
|
|
||
| from botbuilder.core import BotAdapter, StatePropertyAccessor, TurnContext | ||
| from botbuilder.dialogs import ( | ||
| Dialog, | ||
| DialogEvents, | ||
| DialogSet, | ||
| DialogTurnStatus, | ||
| ) | ||
| from botbuilder.schema import Activity, ActivityTypes | ||
| from botframework.connector.auth import ClaimsIdentity, SkillValidation | ||
|
|
||
|
|
||
| class DialogExtensions: | ||
| @staticmethod | ||
| async def run_dialog( | ||
| dialog: Dialog, turn_context: TurnContext, accessor: StatePropertyAccessor | ||
| ): | ||
| dialog_set = DialogSet(accessor) | ||
tracyboehrer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| dialog_set.add(dialog) | ||
|
|
||
| dialog_context = await dialog_set.create_context(turn_context) | ||
|
|
||
| claims = turn_context.turn_state.get(BotAdapter.BOT_IDENTITY_KEY) | ||
| if isinstance(claims, ClaimsIdentity) and SkillValidation.is_skill_claim( | ||
| claims.claims | ||
| ): | ||
| # The bot is running as a skill. | ||
| if ( | ||
| turn_context.activity.type == ActivityTypes.end_of_conversation | ||
| and dialog_context.stack | ||
| ): | ||
| await dialog_context.cancel_all_dialogs() | ||
| else: | ||
| # Process a reprompt event sent from the parent. | ||
| if ( | ||
| turn_context.activity.type == ActivityTypes.event | ||
| and turn_context.activity.name == DialogEvents.reprompt_dialog | ||
| and dialog_context.stack | ||
| ): | ||
| await dialog_context.reprompt_dialog() | ||
| return | ||
|
|
||
| # Run the Dialog with the new message Activity and capture the results | ||
| # so we can send end of conversation if needed. | ||
| result = await dialog_context.continue_dialog() | ||
| if result.status == DialogTurnStatus.Empty: | ||
| start_message_text = f"Starting {dialog.id}" | ||
| await turn_context.send_trace_activity( | ||
| f"Extension {Dialog.__name__}.run_dialog", | ||
| label=start_message_text, | ||
| ) | ||
| result = await dialog_context.begin_dialog(dialog.id) | ||
|
|
||
| # Send end of conversation if it is completed or cancelled. | ||
| if ( | ||
| result.status == DialogTurnStatus.Complete | ||
| or result.status == DialogTurnStatus.Cancelled | ||
| ): | ||
| end_message_text = f"Dialog {dialog.id} has **completed**. Sending EndOfConversation." | ||
| await turn_context.send_trace_activity( | ||
| f"Extension {Dialog.__name__}.run_dialog", | ||
| label=end_message_text, | ||
| value=result.result, | ||
| ) | ||
|
|
||
| activity = Activity( | ||
| type=ActivityTypes.end_of_conversation, value=result.result | ||
| ) | ||
| await turn_context.send_activity(activity) | ||
|
|
||
| else: | ||
| # The bot is running as a standard bot. | ||
| results = await dialog_context.continue_dialog() | ||
| if results.status == DialogTurnStatus.Empty: | ||
| await dialog_context.begin_dialog(dialog.id) | ||
17 changes: 17 additions & 0 deletions
17
libraries/botbuilder-dialogs/botbuilder/dialogs/skills/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # coding=utf-8 | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # -------------------------------------------------------------------------- | ||
|
|
||
| from .begin_skill_dialog_options import BeginSkillDialogOptions | ||
| from .skill_dialog_options import SkillDialogOptions | ||
| from .skill_dialog import SkillDialog | ||
|
|
||
|
|
||
| __all__ = [ | ||
| "BeginSkillDialogOptions", | ||
| "SkillDialogOptions", | ||
| "SkillDialog", | ||
| ] |
18 changes: 18 additions & 0 deletions
18
libraries/botbuilder-dialogs/botbuilder/dialogs/skills/begin_skill_dialog_options.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
|
|
||
| from botbuilder.schema import Activity | ||
|
|
||
|
|
||
| class BeginSkillDialogOptions: | ||
| def __init__(self, activity: Activity): # pylint: disable=unused-argument | ||
| self.activity = activity | ||
|
|
||
| @staticmethod | ||
| def from_object(obj: object) -> "BeginSkillDialogOptions": | ||
| if isinstance(obj, dict) and "activity" in obj: | ||
| return BeginSkillDialogOptions(obj["activity"]) | ||
| if hasattr(obj, "activity"): | ||
| return BeginSkillDialogOptions(obj.activity) | ||
|
|
||
| return None |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.