Skip to content

Commit

Permalink
fixes #506 - bot prompts 'What is the question?' when using ElicitRes…
Browse files Browse the repository at this point in the history
…ponse
  • Loading branch information
rstrahan committed Oct 13, 2022
1 parent ede14e1 commit f1c1ed1
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lambda/fulfillment/lib/middleware/lex.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,18 @@ function isConnectClientChat(req){
}

function isElicitResponse(request, response){
return _.get(response,'result.elicitResponse.responsebot_hook', undefined) !== undefined || _.get(request,'session.qnabotcontext.specialtyBot' ,undefined) !== undefined;
let result = false;
const qnabotcontextJSON = _.get(response,'session.qnabotcontext');
if (qnabotcontextJSON) {
const qnabotcontext = JSON.parse(qnabotcontextJSON);
if (_.get(qnabotcontext,'elicitResponse.responsebot')) {
result = true;
}
if (_.get(qnabotcontext,'specialtyBot')) {
result = true;
}
}
return result;
}

function trapIgnoreWords(req, transcript) {
Expand Down Expand Up @@ -395,9 +406,7 @@ function getV2ElicitTemplate(request, response){
sessionState: {
sessionAttributes:_.get(response,'session',{}),
dialogAction:{
type:'ElicitSlot',
slotToElicit: 'qnaslot'
},
type:'ElicitIntent' },
intent: {
name: 'QnaIntent',
},
Expand Down

0 comments on commit f1c1ed1

Please sign in to comment.