@tiledesk/tiledesk-server 2.9.19 → 2.9.21

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -5,7 +5,13 @@
5
5
  🚀 IN PRODUCTION 🚀
6
6
  (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
7
7
 
8
- # 2.9.18
8
+ # 2.9.21
9
+ - Updated: tybot-connector to 0.2.96
10
+
11
+ # 2.9.20
12
+ - Fixed bug: delete namespace doesn't work properly (wrong namespace)
13
+
14
+ # 2.9.19
9
15
  - Update: force lastRequestsLimit to be a number
10
16
 
11
17
  # 2.9.18
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-server",
3
3
  "description": "The Tiledesk server module",
4
- "version": "2.9.19",
4
+ "version": "2.9.21",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -48,7 +48,7 @@
48
48
  "@tiledesk/tiledesk-rasa-connector": "^1.0.10",
49
49
  "@tiledesk/tiledesk-telegram-connector": "^0.1.14",
50
50
  "@tiledesk/tiledesk-train-jobworker": "^0.0.11",
51
- "@tiledesk/tiledesk-tybot-connector": "^0.2.96-rc1",
51
+ "@tiledesk/tiledesk-tybot-connector": "^0.2.96",
52
52
  "@tiledesk/tiledesk-whatsapp-connector": "^0.1.72",
53
53
  "@tiledesk/tiledesk-whatsapp-jobworker": "^0.0.8",
54
54
  "@tiledesk/tiledesk-sms-connector": "^0.1.10",
package/routes/kb.js CHANGED
@@ -1053,14 +1053,28 @@ router.delete('/:kb_id', async (req, res) => {
1053
1053
  let kb_id = req.params.kb_id;
1054
1054
  winston.verbose("delete kb_id " + kb_id);
1055
1055
 
1056
+
1057
+ let kb = await KB.findOne({ id_project: project_id, _id: kb_id}).catch((err) => {
1058
+ winston.warn("Unable to find kb. Error: ", err);
1059
+ return res.status(500).send({ success: false, error: err })
1060
+ })
1061
+
1062
+ if (!kb) {
1063
+ winston.error("Unable to delete kb. Kb not found...")
1064
+ return res.status(404).send({ success: false, error: "Content not found" })
1065
+ }
1066
+
1056
1067
  let data = {
1057
1068
  id: kb_id,
1058
- namespace: project_id
1069
+ namespace: kb.namespace
1070
+ }
1071
+
1072
+ if (!data.namespace) {
1073
+ data.namespace = project_id;
1059
1074
  }
1060
1075
 
1061
1076
  openaiService.deleteIndex(data).then((resp) => {
1062
1077
  winston.debug("delete resp: ", resp.data);
1063
-
1064
1078
  if (resp.data.success === true) {
1065
1079
  KB.findByIdAndDelete(kb_id, (err, deletedKb) => {
1066
1080
 
package/routes/request.js CHANGED
@@ -1476,19 +1476,19 @@ router.get('/count', async (req, res) => {
1476
1476
  winston.error("Error getting unassigned requests count: ", err);
1477
1477
  res.status(400).send({ success: false, error: err });
1478
1478
  })
1479
- winston.info("Unassigned count: ", unassigned_count);
1479
+ winston.debug("Unassigned count for project " + id_project + ": " + unassigned_count);
1480
1480
 
1481
1481
  human_assigned_count = await Request.countDocuments({ id_project: id_project, status: 200, preflight: false, hasBot: false }).catch((err) => {
1482
1482
  winston.error("Error getting human unassigned requests count: ", err);
1483
1483
  res.status(400).send({ success: false, error: err });
1484
1484
  })
1485
- winston.info("Unassigned count: ", unassigned_count);
1485
+ winston.debug("Human assigned count for project " + id_project + ": " + human_assigned_count);
1486
1486
 
1487
1487
  bot_assigned_count = await Request.countDocuments({ id_project: id_project, status: 200, preflight: false, hasBot: true }).catch((err) => {
1488
1488
  winston.error("Error getting bot assigned requests count: ", err);
1489
1489
  res.status(400).send({ success: false, error: err });
1490
1490
  })
1491
- winston.info("Unassigned count: ", bot_assigned_count);
1491
+ winston.debug("Bot assigned count for project " + id_project + ": " + bot_assigned_count);
1492
1492
 
1493
1493
 
1494
1494
  if (merge_assigned) {