Skip to content

Commit

Permalink
✨ feat: Add config option to specify TIE timeout seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
jolzee committed Nov 5, 2020
1 parent 0e169d3 commit a19298d
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 49 deletions.
3 changes: 3 additions & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const config = {
compressJavascript: true, // gzip and brotli compress JavaScript
produceSourceMap: false // in production you probably want to disable
},
tie: {
timeoutSecs: 20 // Timeout value for request to TIE
},
demoMode: true, // true = stores configs in local storage. In production it should be false
/**
* https://www.livechat.com/ integration - live chat handover
Expand Down
49 changes: 8 additions & 41 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"is-html": "^2.0.0",
"is-mobile": "^2.2.2",
"jsonpack": "^1.1.5",
"leopard-tie-client": "^3.0.4",
"leopard-tie-client": "^3.1.2",
"logrocket": "^1.0.14",
"logrocket-vuex": "0.0.3",
"markdown-it": "^12.0.2",
Expand Down
35 changes: 28 additions & 7 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1778,9 +1778,12 @@ function storeSetup(vuetify) {
queryObj.text = ""; // it's a login we don't have to say anything yet
queryObj.feedback = JSON.stringify(feedback);

TIE.sendInput(context.getters.teneoUrl, context.getters.teneoSessionId, queryObj).then(() =>
logger.debug("Feedback sent to Teneo")
);
TIE.sendInput(
context.getters.teneoUrl,
context.getters.teneoSessionId,
queryObj,
window.leopardConfig.tieTimeoutSecs
).then(() => logger.debug("Feedback sent to Teneo"));
},
setUserInformation({ commit, getters }) {
if (!window.leopardConfig.firebase.apiKey) {
Expand Down Expand Up @@ -2011,7 +2014,11 @@ function storeSetup(vuetify) {
},
endTeneoSessionLite(context) {
context.commit("REMOVE_MODAL_ITEM");
TIE.close(context.getters.teneoUrl, context.getters.teneoSessionId)
TIE.close(
context.getters.teneoUrl,
context.getters.teneoSessionId,
window.leopardConfig.tieTimeoutSecs
)
.then(() => {
context.commit("CLEAR_TENEO_SESSION_ID");
logger.debug("Session Ended");
Expand All @@ -2023,7 +2030,11 @@ function storeSetup(vuetify) {
endTeneoSession(context) {
context.commit("CLEAR_DIALOGS");
context.commit("REMOVE_MODAL_ITEM");
TIE.close(context.getters.teneoUrl, context.getters.teneoSessionId)
TIE.close(
context.getters.teneoUrl,
context.getters.teneoSessionId,
window.leopardConfig.tieTimeoutSecs
)
.then(() => {
context.commit("CLEAR_TENEO_SESSION_ID");
context.commit("HIDE_CHAT_LOADING");
Expand All @@ -2041,7 +2052,12 @@ function storeSetup(vuetify) {
return new Promise((resolve, reject) => {
let queryObj = buildQueryParamsObjectNewTeneoSession(context); // it's a login we don't have to say anything yet

TIE.sendInput(context.getters.teneoUrl, context.getters.teneoSessionId, queryObj)
TIE.sendInput(
context.getters.teneoUrl,
context.getters.teneoSessionId,
queryObj,
window.leopardConfig.tieTimeoutSecs
)
.then(json => {
handleLoginResponse(context, json, vuetify, resolve);
})
Expand Down Expand Up @@ -2155,7 +2171,12 @@ async function handleTeneoResponse(currentUserInput, context, params, vuetify) {
logger.debug("Question 💬", currentUserInput.trim());
await sleep(context.getters.responseDelay); // delay responses if needed
let queryObj = buildQueryParamsObjectUserInput(params, context, currentUserInput);
TIE.sendInput(context.getters.teneoUrl, context.getters.teneoSessionId, queryObj)
TIE.sendInput(
context.getters.teneoUrl,
context.getters.teneoSessionId,
queryObj,
window.leopardConfig.tieTimeoutSecs
)
.then(json => {
// live chat assist - train
if (params.indexOf("command=train") !== -1) {
Expand Down
1 change: 1 addition & 0 deletions src/utils/buildConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ let leopardConfig = {
solutionConfig: {
buildConfig: solutionConfig
},
tieTimeoutSecs: config.get("tie.timeoutSecs", 20),
mustSendLocationAtLogin: config.get("location.login.sendAtLogin", true),
ipUrl: config.get("location.login.serviceUrls.ip"),
geoUrl: config.get("location.login.serviceUrls.geo"),
Expand Down

0 comments on commit a19298d

Please sign in to comment.