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 suggestionsActivityFactory & tests, fix QnAMakerDialog bugs #3475

Merged
merged 4 commits into from
Mar 29, 2021

Conversation

stevengum
Copy link
Member

Fixes part of #3464

Description

Adds type QnASuggestionsActivityFactory for developers to create a custom QnA Maker Active Learning Suggestions Activity to send to users. This provides a more extensive solution to customizing the Activity sent from the QnACardBuilder.getSuggestionsCard which relies on sending Hero Cards.

Through the use of a new constructor overload, developers can pass in this factory instead of the normal activeLearningCardTitle parameter. When developers use the factory, they must pass in the next parameter, cardNoMatchText. This parameter is used in both overloads by the dialog to allow users to indicate that the suggestions from QnA Maker didn't match what the user is asking.

There's a bug fix on onPreBubbleEvent() which should be ported to the other languages. If the incoming activity was a message but an error was thrown during the dialog's execution, it would try to call QnA Maker again. Which is an issue if the error was thrown while trying to call QnA Maker. I encountered this while using nock to ensure an Activity-like value was returned from
QnAMakerdialog.suggestionsActivityFactory and QnACardBuilder.getSuggestionsCard. The latter of which is a public static method, so it can be modified by Typescript developers during bot development.

Testing

Added unit tests

FYI @HesselWellema

@stevengum stevengum requested review from a team as code owners March 29, 2021 19:37
@coveralls
Copy link

coveralls commented Mar 29, 2021

Pull Request Test Coverage Report for Build 699576726

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 16 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.02%) to 84.927%

Files with Coverage Reduction New Missed Lines %
libraries/botbuilder-ai/src/qnaMakerDialog.ts 16 86.53%
Totals Coverage Status
Change from base Build 699567022: 0.02%
Covered Lines: 18886
Relevant Lines: 21175

💛 - Coveralls

@stevengum stevengum merged commit 01b4137 into main Mar 29, 2021
@stevengum stevengum deleted the stgum/3464 branch March 29, 2021 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants