Socket
Socket
Sign inDemoInstall

@xapp/question-answering-handler

Package Overview
Dependencies
229
Maintainers
5
Versions
87
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.4 to 2.0.5

12

lib/constants.js

@@ -6,6 +6,6 @@ "use strict";

outputSpeech: {
displayText: "${TOP_FAQ.markdownText}\nAny other questions?",
displayText: "${TOP_FAQ.markdownText}\n\nAny other questions?",
ssml: "<speak>${TOP_FAQ.text} Any other questions?</speak>",
suggestions: [
{ title: "Read More", url: "${SUGGESTED_ANSWER.source}" }
{ title: "Read More", url: "${TOP_FAQ.source}" }
]

@@ -21,6 +21,6 @@ },

outputSpeech: {
displayText: "${TOP_ANSWER.markdownText}\nAny other questions?",
displayText: "${TOP_ANSWER.markdownText}\n\nAny other questions?",
ssml: "<speak>${TOP_ANSWER.text} Any other questions?</speak>",
suggestions: [
{ title: "Read More", url: "${SUGGESTED_ANSWER.source}" }
{ title: "Read More", url: "${TOP_ANSWER.source}" }
]

@@ -37,4 +37,4 @@ },

outputSpeech: {
displayText: "Here is what I found...\n${SUGGESTED_ANSWER.markdownText}\nAny other questions?",
ssml: "<speak>Here is what I found...\n${SUGGESTED_ANSWER.markdownText}\nAny other questions?</speak>",
displayText: "Here is what I found...\n\"${SUGGESTED_ANSWER.markdownText}\"\nAny other questions?",
ssml: "<speak>Here is what I found...${SUGGESTED_ANSWER.markdownText} Any other questions?</speak>",
suggestions: [

@@ -41,0 +41,0 @@ { title: "Read More", url: "${SUGGESTED_ANSWER.source}" }

@@ -14,2 +14,6 @@ import { KnowledgeBaseResult } from "stentor-models";

["QNA_BOT_LONGEST_HIGHLIGHT"]?: boolean;
/**
* Sometimes the highlights in the FAQ are not great so they are off by default.
*/
["HIGHLIGHT_TOP_FAQ"]?: boolean;
}

@@ -16,0 +20,0 @@ export interface ResultVariableInformation {

@@ -23,3 +23,3 @@ "use strict";

result = Object.assign({}, result);
const { FUZZY_MATCH_FAQS, QNA_BOT_LONGEST_HIGHLIGHT } = config || {};
const { FUZZY_MATCH_FAQS, QNA_BOT_LONGEST_HIGHLIGHT, HIGHLIGHT_TOP_FAQ } = config || {};
// Get possible FAQ matches

@@ -43,5 +43,7 @@ let topFAQ = undefined;

if (topFAQ) {
const text = (0, cleanAnswer_1.cleanAnswer)(topFAQ.document);
const markdownText = HIGHLIGHT_TOP_FAQ ? (0, cleanAnswer_1.cleanAnswer)((0, utils_1.addMarkdownHighlights)(topFAQ.document, topFAQ.highlights)) : text;
variables.TOP_FAQ = {
text: (0, cleanAnswer_1.cleanAnswer)(topFAQ.document),
markdownText: (0, cleanAnswer_1.cleanAnswer)((0, utils_1.addMarkdownHighlights)(topFAQ.document, topFAQ.highlights)),
text,
markdownText,
source: topFAQ.uri,

@@ -57,9 +59,8 @@ handlerId: topFAQ.handlerId

if (suggested.topAnswer) {
// Add suggested with markdown on the displayText with the highlights
const focused = (0, focusAnswer_1.focusAnswer)({ answer: suggested.document, highlights }, config);
// Add markdown
const markedDownText = (0, utils_1.addMarkdownHighlights)(focused.answer, focused.highlights);
// No need to focus the top answer or add highlights since it is a highlight.
const text = (0, cleanAnswer_1.cleanAnswer)(suggested.topAnswer);
const markdownText = (0, cleanAnswer_1.cleanAnswer)(suggested.topAnswer);
variables.TOP_ANSWER = {
text: (0, cleanAnswer_1.cleanAnswer)(suggested.topAnswer),
markdownText: (0, cleanAnswer_1.cleanAnswer)(markedDownText),
text,
markdownText,
source: suggested.uri

@@ -66,0 +67,0 @@ };

@@ -7,3 +7,3 @@ {

},
"version": "2.0.4",
"version": "2.0.5",
"description": "A question answering handler for 📣 stentor",

@@ -10,0 +10,0 @@ "types": "lib/index",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc