@tiledesk/tiledesk-server 2.9.19 → 2.9.20

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/CHANGELOG.md CHANGED
@@ -5,7 +5,10 @@
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.20
9
+ - Fixed bug: delete namespace doesn't work properly (wrong namespace)
10
+
11
+ # 2.9.19
9
12
  - Update: force lastRequestsLimit to be a number
10
13
 
11
14
  # 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.20",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
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) {