Skip to content

Commit

Permalink
Merge pull request #23 from rdoshi99/feature-log-kendra-source
Browse files Browse the repository at this point in the history
Feature log kendra source
  • Loading branch information
rdoshi99 authored Jul 31, 2020
2 parents 8eef533 + 018afdc commit a268493
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lambda/proxy-es/lib/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async function run_query_kendra(req, query_params) {
var kendra_response = await kendra.handler(request_params);

if (_.get(kendra_response, "hits.hits[0]._source")) {
_.set(kendra_response, "hits.hits[0]._source.answersource", "KendraFAQ");
_.set(kendra_response, "hits.hits[0]._source.answersource", "Kendra FAQ");
}

// TODO: check if ever more than 1 answer in kendra FAQ...(check console?)
Expand Down Expand Up @@ -295,7 +295,15 @@ module.exports = async function (req, res) {
res.type = "PlainText"
res.message = res.result.a
res.plainMessage = res.result.a
res.answerSource = _.get(hit, "answersource", "unknown")
// Add answerSource for query hits
var ansSource = _.get(hit, "answersource", "unknown")
if (ansSource==="Kendra FAQ") {
res.answerSource = "KENDRA"
} else if (ansSource==="ElasticSearch" || ansSource==="ES Fallback")
res.answerSource = "ES"
} else {
res.answerSource = ansSource
}

// Add alt messages to appContext session attribute JSON value (for lex-web-ui)
var tmp
Expand Down

0 comments on commit a268493

Please sign in to comment.