bibot 1.0.53 → 1.0.54

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -3537,6 +3537,20 @@ var getRemoteClientChatBubbleConfig = function getRemoteClientChatBubbleConfig(p
3537
3537
  return Promise.reject(e);
3538
3538
  }
3539
3539
  };
3540
+ var recordPredefinedQ = function recordPredefinedQ(pluginAxiosInstance, data) {
3541
+ try {
3542
+ return Promise.resolve(_catch(function () {
3543
+ var path = "" + domain.inference + resources.predefinedQstatistics;
3544
+ return Promise.resolve(pluginAxiosInstance.post(path, data)).then(function (response) {
3545
+ return response.data;
3546
+ });
3547
+ }, function (error) {
3548
+ return error.message;
3549
+ }));
3550
+ } catch (e) {
3551
+ return Promise.reject(e);
3552
+ }
3553
+ };
3540
3554
  var handleRetries = function handleRetries(pluginAxiosInstance, data, attempt) {
3541
3555
  try {
3542
3556
  var maxAttempts = 30;
@@ -3574,28 +3588,20 @@ var askBiBot = function askBiBot(pluginAxiosInstance, data) {
3574
3588
  return Promise.resolve(_catch(function () {
3575
3589
  var path = "" + domain.inference + resources.q;
3576
3590
  return Promise.resolve(pluginAxiosInstance.post(path, data)).then(function (response) {
3577
- if (response.data.message === defaultSlacker) {
3591
+ if (response.data.message === defaultSlacker || response.status === 504) {
3578
3592
  return Promise.resolve(handleRetries(pluginAxiosInstance, data, 1));
3579
3593
  } else {
3580
3594
  return response.data;
3581
3595
  }
3582
3596
  });
3583
- }, function (error1) {
3584
- return error1.message;
3585
- }));
3586
- } catch (e) {
3587
- return Promise.reject(e);
3588
- }
3589
- };
3590
- var recordPredefinedQ = function recordPredefinedQ(pluginAxiosInstance, data) {
3591
- try {
3592
- return Promise.resolve(_catch(function () {
3593
- var path = "" + domain.inference + resources.predefinedQstatistics;
3594
- return Promise.resolve(pluginAxiosInstance.post(path, data)).then(function (response) {
3595
- return response.data;
3596
- });
3597
3597
  }, function (error) {
3598
- return error.message;
3598
+ if (error.response && error.response.status === 504) {
3599
+ return Promise.resolve(handleRetries(pluginAxiosInstance, data, 1));
3600
+ } else {
3601
+ return {
3602
+ message: error.message
3603
+ };
3604
+ }
3599
3605
  }));
3600
3606
  } catch (e) {
3601
3607
  return Promise.reject(e);
@@ -3609,9 +3615,15 @@ var askTimedOutBiBot = function askTimedOutBiBot(pluginAxiosInstance, data) {
3609
3615
  return response.data;
3610
3616
  });
3611
3617
  }, function (error) {
3612
- return {
3613
- message: error.message
3614
- };
3618
+ if (error.response && error.response.status === 504) {
3619
+ return {
3620
+ message: defaultSlacker
3621
+ };
3622
+ } else {
3623
+ return {
3624
+ message: error.message
3625
+ };
3626
+ }
3615
3627
  }));
3616
3628
  } catch (e) {
3617
3629
  return Promise.reject(e);