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

Specialty bot routing fixes, Lex Intent state fixes, handlebar processing of SSML injects "\n" into response. #726

Conversation

bobpskier
Copy link
Contributor

Issue #, if available: 674

Description of changes:

A couple of fixes are addressed in this pull request.

a) fix LexV2 lambda return templates (lambda/fulfillment/lib/middleware/lex.js) for elicitIntent (getV2ElicitTemplate) dialogCodeHook (getV2DialogCodeHookResponseTemplate) to return state and slots as part of intent structure.

b) fix processing of SSML in handlebars.js (lambda/es-proxy-layer/lib/handlebars.js) such that new lines (\n) are not injected as part of template processing. Designer UI allows the creation of a response for SSML using handlebar syntax where new lines are allowed in the template and cause handlebars to inject a "\n" in the response which causes Lex V2 to return an invalid audio/ogg stream.

c) Integrate original lexv2 bug fixes from first PR for speciltyBotRouter.js and implement additional fixes as necessary. Address the following merge and feature issues:

specialtyBotRouter.js will throw an exception as LexV2 will sometimes not return an intent as expected at lexv2response.sessionState.intent. The revised code is not handling this condition.

specialtyBotRouter.js will throw an exception in getDialogState() for the same undefined lexv2response.sessionState.intent.

bot router termination is not preserving the last message from the specialty bot in endUseOfSpecialtyBot().

both markdown and ssml responses from a target qnabot (specialtyBot) are merged into the the botRouter response. 

merging of specialty bot session attributes for supervisory bot response does not handle special cases for "appContext" and "qnabotcontext" when the specialty bot is another QnaBot.

The matching QID's answer/markdown which initiated bot routing is not provided to the user. The original answer is ignored when it should be prepended as part the response message when bot routing starts.

The superivsory bot does not terminate bot routing when the specialty LexV2 bot reaches fulfillment or is closed. Incorrect states are being checked. Note that a specialty QnABot (also LexV2) target is a special case where bot routing should not be terminated when fulfillment is reached as each answer represents a fulfilled state. A specialty QnABot requires special processing to terminate bot routing either through a defined session attribute or by the user entering the termination phrase.

getRespCard() is incorrectly defining several attributes that should be left undefined. One example is an image url in the response card. When an image url is defined in the response card as an empty string which the present code is setting, the LexV2 service handling the fulfillment response from the supervisory bot will return an error and the UI will display an error.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…qnabot and perform proper exit handling.

Update handlebars.js to remove any "\n" that creep into an SSML response which will cause LexV2 to return badly formed audio.

Update lex.js to return proper intent state for LexV2 ElicitIntent and DialogCodeHook.
@bobpskier bobpskier changed the title Tioth dev specialty bot routing 2024 b Specialty bot routing fixes, Lex Intent state fixes, handlebar processing of SSML injects "\n" into response. May 12, 2024
@fhoueto-amz fhoueto-amz requested a review from abhirpat May 15, 2024 14:08
This was referenced Jun 3, 2024
@abhirpat
Copy link
Member

abhirpat commented Jun 7, 2024

Hi @bobpskier , this issue should be addressed with the latest release v6.0.0. Please refer to CHANGELOG for additional details about this release. Thank You!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants