Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Potterveld committed Jul 8, 2021
2 parents d2db754 + 80bef08 commit 00b57c8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [4.7.2]
- Bug fix "TypeError: AWS.LexRuntimeV2 is not a constructor" when using Lex V2 based Elicit Response Bots.
- Bug fix "Cannot read property 'buttons' of undefined" when no buttons specified in response card.
- Bug fix Protect against TypeError exception while processing fallback intent case for an invalid response provided to a LexV2 Response Bot.
## [4.7.1]
- Amazon Elasticsearch version 7.10 is now utilized.
- Encrypted Elasticsearch (production) instance types now use m6g.large.elasticsearch for improved price/performance/memory.
Expand Down
2 changes: 1 addition & 1 deletion lambda/fulfillment/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ DST=../../build/lambda/$(NAME).zip
RESOURCES := $(shell find . | grep -v node_modules | grep -v test )

$(DST): $(RESOURCES)
echo "Building $(NAME)"; npm install -production && zip -r -q $(DST) .
echo "Building $(NAME)"; rm $(DST); npm install -production && zip -r -q $(DST) .
7 changes: 1 addition & 6 deletions lambda/fulfillment/lib/middleware/lex.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,10 @@ function limitLexDisplayTextLength(response) {
// Lex has limit of max 5 buttons in the responsecard.. if we have more than 5, use the first 5 only.
// note when using lex-web-ui, this limitation is circumvented by use of the appContext session attribute above.
let buttons = _.get(response.card,"buttons",[]) ;
console.log("in limitLexDisplayText")
console.log(buttons)
for(i=0;i<response.card.buttons.length;i++){
for(let i=0;i<buttons.length;i++){
response.card.buttons[i].text = response.card.buttons[i].text.slice(0,50)
response.card.buttons[i].value = response.card.buttons[i].value.slice(0,50)

}
console.log("after limitLexDisplayTextLength")
console.log(JSON.stringify(response))
return response;
}

Expand Down
5 changes: 3 additions & 2 deletions lambda/fulfillment/lib/middleware/lexRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function lexV1ClientRequester(params) {
});
}
function lexV2ClientRequester(params) {
console.log(`aws sdk version is ${AWS.VERSION}`);
const lexV2Client = new AWS.LexRuntimeV2();
return new Promise(function(resolve, reject) {
lexV2Client.recognizeText(params, function(err, data) {
Expand Down Expand Up @@ -167,7 +168,7 @@ async function handleRequest(req, res, botName, botAlias) {
console.log("Lex V2 parameters: " + JSON.stringify(params));
const lexv2response = await lexV2ClientRequester(params);
console.log("Lex V2 response: " + JSON.stringify(lexv2response));
response.message = lexv2response.messages[0].content;
response.message = _.get(lexv2response, 'messages[0].content', '');
// lex v2 FallbackIntent match means it failed to fill desired slot(s).
if (lexv2response.sessionState.intent.name === "FallbackIntent" ||
lexv2response.sessionState.intent.state === "Failed") {
Expand Down Expand Up @@ -319,4 +320,4 @@ async function processResponse(req, res, hook, msg) {
return resp;
}

exports.elicitResponse=processResponse;
exports.elicitResponse=processResponse;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aws-ai-qna-bot",
"version": "4.7.1",
"version": "4.7.2",
"engines": {
"node": ">=12.16.1",
"npm": ">=7.8.0"
Expand Down

0 comments on commit 00b57c8

Please sign in to comment.