@tiledesk/tiledesk-server 2.9.18 → 2.9.20
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +6 -0
- package/app.js +0 -6
- package/package.json +1 -1
- package/routes/kb.js +16 -2
- package/routes/request.js +3 -3
- package/websocket/webSocketServer.js +2 -23
package/CHANGELOG.md
CHANGED
@@ -5,6 +5,12 @@
|
|
5
5
|
🚀 IN PRODUCTION 🚀
|
6
6
|
(https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
|
7
7
|
|
8
|
+
# 2.9.20
|
9
|
+
- Fixed bug: delete namespace doesn't work properly (wrong namespace)
|
10
|
+
|
11
|
+
# 2.9.19
|
12
|
+
- Update: force lastRequestsLimit to be a number
|
13
|
+
|
8
14
|
# 2.9.18
|
9
15
|
- Added: /requests/count endpoint
|
10
16
|
- Updated: sms-connector to 0.1.10
|
package/app.js
CHANGED
@@ -423,12 +423,6 @@ if (process.env.ROUTELOGGER_ENABLED==="true") {
|
|
423
423
|
}
|
424
424
|
|
425
425
|
app.get('/', function (req, res) {
|
426
|
-
|
427
|
-
console.log("(/api) req ", req.headers)
|
428
|
-
console.log("(/api) x-forwarded-for: ", req.headers['x-forwarded-for'], "remote port: ", req.socket.remotePort);
|
429
|
-
console.log("(/api) X-Real-IP ", req.headers['X-Real-IP'])
|
430
|
-
console.log("(/api) remoteAddress: ", req.socket.remoteAddress)
|
431
|
-
|
432
426
|
res.send('Hello from Tiledesk server. It\'s UP. See the documentation here http://developer.tiledesk.com');
|
433
427
|
});
|
434
428
|
|
package/package.json
CHANGED
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:
|
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.
|
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.
|
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.
|
1491
|
+
winston.debug("Bot assigned count for project " + id_project + ": " + bot_assigned_count);
|
1492
1492
|
|
1493
1493
|
|
1494
1494
|
if (merge_assigned) {
|
@@ -40,6 +40,8 @@ var cacheEnabler = require("../services/cacheEnabler");
|
|
40
40
|
var lastRequestsLimit = process.env.WS_HISTORY_REQUESTS_LIMIT || 100;
|
41
41
|
winston.debug('lastRequestsLimit:' + lastRequestsLimit);
|
42
42
|
|
43
|
+
lastRequestsLimit = Number(lastRequestsLimit);
|
44
|
+
|
43
45
|
var messagesLimit = process.env.WS_HISTORY_MESSAGES_LIMIT || 300;
|
44
46
|
winston.debug('messagesLimit:' + messagesLimit);
|
45
47
|
|
@@ -196,29 +198,6 @@ class WebSocketServer {
|
|
196
198
|
var projectId = urlSub[1];
|
197
199
|
winston.debug('projectId: ' + projectId);
|
198
200
|
|
199
|
-
if (projectId === "65203e12f8c0cf002cf4110b"
|
200
|
-
|| projectId === "62c3f10152dc7400352bab0d"
|
201
|
-
|| projectId === "66acec0cf7ebf80013d67974"
|
202
|
-
|| projectId === "6613ff078890fc0013ad3c3a"
|
203
|
-
|| projectId === "6565047fdd64fd001323f37c"
|
204
|
-
|| projectId === "656054000410fa00132e5dcc") {
|
205
|
-
|
206
|
-
console.log('(WebSocket) WSS onSubscribeCallback - ProjectID ' + projectId);
|
207
|
-
console.log("(WebSocket) req ", req.headers)
|
208
|
-
console.log("(WebSocket) x-forwarded-for: ", req.headers['x-forwarded-for'], "remote port: ", req.socket.remotePort);
|
209
|
-
console.log("(/api) X-Real-IP ", req.headers['X-Real-IP'])
|
210
|
-
console.log("(WebSocket) remoteAddress: ", req.socket.remoteAddress)
|
211
|
-
|
212
|
-
|
213
|
-
try {
|
214
|
-
console.log("req: ", JSON.stringify(req))
|
215
|
-
} catch(err) {
|
216
|
-
console.log("Unable to stringify request")
|
217
|
-
console.log("req: ", req)
|
218
|
-
}
|
219
|
-
|
220
|
-
}
|
221
|
-
|
222
201
|
let q = Project.findOne({ _id: projectId, status: 100 })
|
223
202
|
|
224
203
|
if (cacheEnabler.project) {
|