bibot 1.0.53 → 1.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +37 -20
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +37 -20
- package/dist/index.modern.js.map +1 -1
- package/dist/services/plugin-api.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3286,7 +3286,11 @@ var createPluginAxiosInstance = function createPluginAxiosInstance(baseURL, para
|
|
|
3286
3286
|
try {
|
|
3287
3287
|
var errMsg = 'An unknown error occurred';
|
|
3288
3288
|
if (error.response) {
|
|
3289
|
-
|
|
3289
|
+
if (error.response.status === 504) {
|
|
3290
|
+
errMsg = 'Timeout error occurred';
|
|
3291
|
+
} else {
|
|
3292
|
+
errMsg = error.response.data.message || error.response.statusText;
|
|
3293
|
+
}
|
|
3290
3294
|
} else if (error.request) {
|
|
3291
3295
|
errMsg = 'No response received from the server.';
|
|
3292
3296
|
} else {
|
|
@@ -3537,6 +3541,20 @@ var getRemoteClientChatBubbleConfig = function getRemoteClientChatBubbleConfig(p
|
|
|
3537
3541
|
return Promise.reject(e);
|
|
3538
3542
|
}
|
|
3539
3543
|
};
|
|
3544
|
+
var recordPredefinedQ = function recordPredefinedQ(pluginAxiosInstance, data) {
|
|
3545
|
+
try {
|
|
3546
|
+
return Promise.resolve(_catch(function () {
|
|
3547
|
+
var path = "" + domain.inference + resources.predefinedQstatistics;
|
|
3548
|
+
return Promise.resolve(pluginAxiosInstance.post(path, data)).then(function (response) {
|
|
3549
|
+
return response.data;
|
|
3550
|
+
});
|
|
3551
|
+
}, function (error) {
|
|
3552
|
+
return error.message;
|
|
3553
|
+
}));
|
|
3554
|
+
} catch (e) {
|
|
3555
|
+
return Promise.reject(e);
|
|
3556
|
+
}
|
|
3557
|
+
};
|
|
3540
3558
|
var handleRetries = function handleRetries(pluginAxiosInstance, data, attempt) {
|
|
3541
3559
|
try {
|
|
3542
3560
|
var maxAttempts = 30;
|
|
@@ -3574,28 +3592,20 @@ var askBiBot = function askBiBot(pluginAxiosInstance, data) {
|
|
|
3574
3592
|
return Promise.resolve(_catch(function () {
|
|
3575
3593
|
var path = "" + domain.inference + resources.q;
|
|
3576
3594
|
return Promise.resolve(pluginAxiosInstance.post(path, data)).then(function (response) {
|
|
3577
|
-
if (response.data.message === defaultSlacker) {
|
|
3595
|
+
if (response.data.message === defaultSlacker || response.status === 504) {
|
|
3578
3596
|
return Promise.resolve(handleRetries(pluginAxiosInstance, data, 1));
|
|
3579
3597
|
} else {
|
|
3580
3598
|
return response.data;
|
|
3581
3599
|
}
|
|
3582
3600
|
});
|
|
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
3601
|
}, function (error) {
|
|
3598
|
-
|
|
3602
|
+
if (error.message === timeoutMessage) {
|
|
3603
|
+
return Promise.resolve(handleRetries(pluginAxiosInstance, data, 1));
|
|
3604
|
+
} else {
|
|
3605
|
+
return {
|
|
3606
|
+
message: error.message
|
|
3607
|
+
};
|
|
3608
|
+
}
|
|
3599
3609
|
}));
|
|
3600
3610
|
} catch (e) {
|
|
3601
3611
|
return Promise.reject(e);
|
|
@@ -3609,15 +3619,22 @@ var askTimedOutBiBot = function askTimedOutBiBot(pluginAxiosInstance, data) {
|
|
|
3609
3619
|
return response.data;
|
|
3610
3620
|
});
|
|
3611
3621
|
}, function (error) {
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3622
|
+
if (error.message === timeoutMessage) {
|
|
3623
|
+
return {
|
|
3624
|
+
message: defaultSlacker
|
|
3625
|
+
};
|
|
3626
|
+
} else {
|
|
3627
|
+
return {
|
|
3628
|
+
message: error.message
|
|
3629
|
+
};
|
|
3630
|
+
}
|
|
3615
3631
|
}));
|
|
3616
3632
|
} catch (e) {
|
|
3617
3633
|
return Promise.reject(e);
|
|
3618
3634
|
}
|
|
3619
3635
|
};
|
|
3620
3636
|
var defaultSlacker = "BiBot_Retry_Later";
|
|
3637
|
+
var timeoutMessage = 'Timeout error occurred';
|
|
3621
3638
|
|
|
3622
3639
|
var useBiBotChatBot = function useBiBotChatBot(bibotProps) {
|
|
3623
3640
|
var sendInputInquiry = function sendInputInquiry() {
|