8000 Axsuarez/qna model fix by axelsrz · Pull Request #868 · microsoft/botbuilder-python · GitHub
[go: up one dir, main page]

Skip to content

Axsuarez/qna model fix #868

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 5 commits into from
Mar 17, 2020
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 @@ -56,5 +56,7 @@ def __init__(
self.score = score
self.metadata = list(map(lambda meta: Metadata(**meta), metadata))
self.source = source
self.context = QnAResponseContext(**context) if context is not None else None
self.context = (
QnAResponseContext().from_dict(context) if context is not None else None
)
self.id = id # pylint: disable=invalid-name
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ async def run_dialog(
if (
turn_context.activity.type == ActivityTypes.end_of_conversation
and dialog_context.stack
and DialogExtensions.__is_eoc_coming_from_parent(turn_context)
):
remote_cancel_text = "Skill was canceled through an EndOfConversation activity from the parent."
await turn_context.send_trace_activity(
f"Extension {Dialog.__name__}.run_dialog", label=remote_cancel_text,
)

await dialog_context.cancel_all_dialogs()
else:
# Process a reprompt event sent from the parent.
Expand Down Expand Up @@ -75,3 +81,9 @@ async def run_dialog(
results = await dialog_context.continue_dialog()
if results.status == DialogTurnStatus.Empty:
await dialog_context.begin_dialog(dialog.id)

@staticmethod
def __is_eoc_coming_from_parent(turn_context: TurnContext) -> bool:
# To determine the direction we check callerId property which is set to the parent bot
# by the BotFrameworkHttpClient on outgoing requests.
return bool(turn_context.activity.caller_id)
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,18 @@ async def _send_oauth_card(
link = sign_in_resource.sign_in_link
bot_identity: ClaimsIdentity = context.turn_state.get("BotIdentity")

# use the SignInLink when
# in speech channel or
# bot is a skill or
# an extra OAuthAppCredentials is being passed in
if (
bot_identity and SkillValidation.is_skill_claim(bot_identity.claims)
) or not context.activity.service_url.startswith("http"):
(
bot_identity
and SkillValidation.is_skill_claim(bot_identity.claims)
)
or not context.activity.service_url.startswith("http")
or self._settings.oath_app_credentials
):
if context.activity.channel_id == Channels.emulator:
card_action_type = ActionTypes.open_url
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def post_activity(
)
activity.conversation.id = conversation_id
activity.service_url = service_url
activity.caller_id = from_bot_id
activity.caller_id = f"urn:botframework:aadappid:{from_bot_id}"

headers_dict = {
"Content-type": "application/json; charset=utf-8",
Expand Down
4 changes: 2 additions & 2 deletions ci-pr-pipeline.yml → pipelines/botbuilder-python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ variables:
python.36: 3.6.10
python.37: 3.7.6
python.38: 3.8.2

# PythonCoverallsToken: get this from Azure

jobs:
# Build and publish container
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
- script: 'pylint --rcfile=.pylintrc libraries'
displayName: Pylint

- script: 'COVERALLS_REPO_TOKEN=$(COVERALLS_TOKEN) coveralls'
- script: 'COVERALLS_REPO_TOKEN=$(PythonCoverallsToken) coveralls'
displayName: 'Push test results to coveralls https://coveralls.io/github/microsoft/botbuilder-python'
continueOnError: true

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
trigger:
#
# Run functional test on bot deployed to a Docker Linux environment in Azure.
#
pool:
vmImage: 'Ubuntu-16.04'

trigger: # ci trigger
branches:
include:
- daveta-python-functional
exclude:
- master
- master

pr: none # no pr trigger

variables:
# Container registry service connection established during pipeline creation
Expand All @@ -14,15 +20,11 @@ variables:
webAppName: 'e2epython'
containerRegistry: 'nightlye2etest.azurecr.io'
imageRepository: 'functionaltestpy'



# LinuxTestBotAppId: get this from azure
# LinuxTestBotAppSecret: get this from Azure

jobs:
# Build and publish container
- job: Build
pool:
vmImage: 'Ubuntu-16.04'
displayName: Build and push bot image
continueOnError: false
steps:
Expand All @@ -35,12 +37,8 @@ jobs:
containerRegistry: $(dockerRegistryServiceConnection)
tags: $(buildIdTag)



- job: Deploy
displayName: Provision bot container
pool:
vmImage: 'Ubuntu-16.04'
dependsOn:
- Build
steps:
Expand All @@ -54,8 +52,6 @@ jobs:
DockerNamespace: $(containerRegistry)
DockerRepository: $(imageRepository)
DockerImageTag: $(buildIdTag)
AppSettings: '-MicrosoftAppId $(botAppId) -MicrosoftAppPassword $(botAppPassword) -FLASK_APP /functionaltestbot/app.py -FLASK_DEBUG 1'
AppSettings: '-MicrosoftAppId $(LinuxTestBotAppId) -MicrosoftAppPassword $(LinuxTestBotAppSecret) -FLASK_APP /functionaltestbot/app.py -FLASK_DEBUG 1'

#StartupCommand: 'flask run --host=0.0.0.0 --port=3978'


0