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

feat: Add support for Teams Adaptive cards in QnA Dialog #4467

Merged
merged 13 commits into from
May 30, 2023

Conversation

anishprasad01
Copy link
Contributor

@anishprasad01 anishprasad01 commented Apr 27, 2023

Fixes Internal IcM Issue #373550043
Fixes #4476

Description

This PR allows for choosing Adaptive Cards formatted for use in Microsoft Teams instead of the default Hero Cards. This is done to support markdown formatting in QnA and CQA responses since Teams only supports markdown in Adaptive Cards. Changes are made in qnaCardBuilder.ts and qnaMakerDialog.ts.

Using the new cards simple requires adding code in the bot to take in a new environment variable: UseTeamsAdaptiveCard = "true" and pass it to the QnA dialog constructor. If no changes are made, the bot will default to a Hero card.

Specific Changes

  • Create new methods to generate adaptive and hero cards
  • Modify the card builder class to take in a new bool field to allow for choosing whether or not to use an adaptive card
  • Modify the dialog class to accept the aforementioned bool field and pass it to the card builder.

Testing

Tests ran successfully.
Screenshot 2023-04-27 115625

@anishprasad01 anishprasad01 added customer-reported Issue is created by anyone that is not a collaborator in the repository. Bot Services Required for internal Azure reporting. Do not delete. Do not change color. Area: AI-QnAMaker The issue is related to QnA Maker feature-request A request for new functionality or an enhancement to an existing one. labels Apr 27, 2023
@anishprasad01 anishprasad01 self-assigned this Apr 27, 2023
@anishprasad01 anishprasad01 added the Automation: Parity with dotnet The PR needs to be ported to dotnet. label Apr 27, 2023
@coveralls
Copy link

coveralls commented Apr 27, 2023

Pull Request Test Coverage Report for Build 5062720546

  • 17 of 19 (89.47%) changed or added relevant lines in 2 files are covered.
  • 40 unchanged lines in 7 files lost coverage.
  • Overall coverage increased (+0.5%) to 84.857%

Changes Missing Coverage Covered Lines Changed/Added Lines %
libraries/botbuilder-ai/src/qnaMakerDialog.ts 4 6 66.67%
Files with Coverage Reduction New Missed Lines %
libraries/botbuilder-ai/src/qnaMakerDialog.ts 1 84.93%
libraries/botbuilder-core/src/configurationServiceClientCredentialFactory.ts 2 97.03%
libraries/botbuilder-core/src/turnContext.ts 2 97.8%
libraries/botframework-connector/src/auth/jwtTokenExtractor.ts 2 73.04%
libraries/botbuilder-core/src/telemetryLoggerMiddleware.ts 5 82.22%
libraries/botbuilder-core/src/configurationBotFrameworkAuthentication.ts 6 79.17%
libraries/botbuilder-azure/src/cosmosDbPartitionedStorage.ts 22 76.42%
Totals Coverage Status
Change from base Build 4792156003: 0.5%
Covered Lines: 20109
Relevant Lines: 22466

💛 - Coveralls

@anishprasad01 anishprasad01 marked this pull request as ready for review May 11, 2023 19:19
@anishprasad01 anishprasad01 requested a review from a team as a code owner May 11, 2023 19:19
Copy link
Collaborator

@ceciliaavila ceciliaavila left a comment

Choose a reason for hiding this comment

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

Just some small details. Same that the .NET PR, we could add tests to cover the new code.

libraries/botbuilder-ai/src/qnaCardBuilder.ts Outdated Show resolved Hide resolved
libraries/botbuilder-ai/src/qnaCardBuilder.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@ceciliaavila ceciliaavila left a comment

Choose a reason for hiding this comment

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

Hi @anishprasad01, why are all those docs necessary? The rest of the changes look good.

@anishprasad01
Copy link
Contributor Author

@ceciliaavila

The pipeline checks required they be generated. I simply ran the script to create them.

@tracyboehrer tracyboehrer merged commit da25217 into main May 30, 2023
@tracyboehrer tracyboehrer deleted the anishprasad01/CQA-adaptive-cards branch May 30, 2023 16:51
@ceciliaavila
Copy link
Collaborator

@ceciliaavila

The pipeline checks required they be generated. I simply ran the script to create them.

The only doc requested is botbuilder-ai.api.md in the etc folder.
I ran the checks after removing the new doc folder and they passed. The doc folder can be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: AI-QnAMaker The issue is related to QnA Maker Automation: Parity with dotnet The PR needs to be ported to dotnet. Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-reported Issue is created by anyone that is not a collaborator in the repository. feature-request A request for new functionality or an enhancement to an existing one.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QnAMakerDialog cannot render rich text in Teams channel
4 participants