@tiledesk/tiledesk-server 2.10.9 → 2.10.11
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +5 -0
- package/app.js +2 -2
- package/package.json +2 -2
- package/routes/email.js +1 -1
- package/routes/faq_kb.js +4 -4
- package/routes/kb.js +5 -6
- package/routes/request.js +1 -1
- package/test/app-test.js +50 -0
package/CHANGELOG.md
CHANGED
@@ -5,6 +5,11 @@
|
|
5
5
|
🚀 IN PRODUCTION 🚀
|
6
6
|
(https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
|
7
7
|
|
8
|
+
# 2.10.11
|
9
|
+
- Updated tybot-connector to 0.2.118
|
10
|
+
- Removed logs
|
11
|
+
- Removed $clusterTime from add kb response
|
12
|
+
|
8
13
|
# 2.10.9
|
9
14
|
- Removed logs
|
10
15
|
- Updated tiledesk-apps to 1.0.26
|
package/app.js
CHANGED
@@ -458,11 +458,11 @@ var projectSetter = function (req, res, next) {
|
|
458
458
|
if (err) {
|
459
459
|
winston.warn("Problem getting project with id: " + projectid + " req.originalUrl: " + req.originalUrl);
|
460
460
|
}
|
461
|
-
|
462
461
|
winston.debug("projectSetter project:" + project);
|
463
462
|
if (!project) {
|
464
463
|
winston.warn("ProjectSetter project not found with id: " + projectid);
|
465
|
-
next();
|
464
|
+
//next();
|
465
|
+
return res.status(400).send({ error: "Project not found with id: " + projectid })
|
466
466
|
} else {
|
467
467
|
req.project = project;
|
468
468
|
next(); //call next one time for projectSetter function
|
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.10.
|
4
|
+
"version": "2.10.11",
|
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.
|
51
|
+
"@tiledesk/tiledesk-tybot-connector": "^0.2.118",
|
52
52
|
"@tiledesk/tiledesk-whatsapp-connector": "^0.1.73",
|
53
53
|
"@tiledesk/tiledesk-whatsapp-jobworker": "^0.0.8",
|
54
54
|
"@tiledesk/tiledesk-sms-connector": "^0.1.10",
|
package/routes/email.js
CHANGED
@@ -387,7 +387,7 @@ router.post('/internal/send',
|
|
387
387
|
let replyto = req.body.replyto;
|
388
388
|
winston.debug("replyto: " + replyto);
|
389
389
|
|
390
|
-
winston.info("Sending an email with text : " + text + " to " + to);
|
390
|
+
//winston.info("Sending an email with text : " + text + " to " + to);
|
391
391
|
|
392
392
|
let quoteManager = req.app.get('quote_manager');
|
393
393
|
|
package/routes/faq_kb.js
CHANGED
@@ -833,10 +833,10 @@ router.post('/importjson/:id_faq_kb', roleChecker.hasRole('admin'), upload.singl
|
|
833
833
|
|
834
834
|
if (savingResult) {
|
835
835
|
if (savingResult.lastErrorObject.updatedExisting === true) {
|
836
|
-
winston.
|
836
|
+
winston.verbose("updated existing intent")
|
837
837
|
faqBotEvent.emit('faq.update', savingResult.value);
|
838
838
|
} else {
|
839
|
-
winston.
|
839
|
+
winston.verbose("new intent created")
|
840
840
|
faqBotEvent.emit('faq.create', savingResult.value);
|
841
841
|
}
|
842
842
|
}
|
@@ -849,7 +849,7 @@ router.post('/importjson/:id_faq_kb', roleChecker.hasRole('admin'), upload.singl
|
|
849
849
|
let faq = await Faq.create(new_faq).catch((err) => {
|
850
850
|
if (err.code == 11000) {
|
851
851
|
winston.error("Duplicate intent_display_name.");
|
852
|
-
winston.
|
852
|
+
winston.verbose("Skip duplicated intent_display_name");
|
853
853
|
} else {
|
854
854
|
winston.error("Error creating new intent: ", err);
|
855
855
|
}
|
@@ -857,7 +857,7 @@ router.post('/importjson/:id_faq_kb', roleChecker.hasRole('admin'), upload.singl
|
|
857
857
|
})
|
858
858
|
|
859
859
|
if (faq) {
|
860
|
-
winston.
|
860
|
+
winston.verbose("new intent created")
|
861
861
|
faqBotEvent.emit('faq.create', faq);
|
862
862
|
}
|
863
863
|
}
|
package/routes/kb.js
CHANGED
@@ -521,8 +521,8 @@ router.get('/namespace/:id/chunks/:content_id', async (req, res) => {
|
|
521
521
|
return res.status(200).send(chunks);
|
522
522
|
|
523
523
|
}).catch((err) => {
|
524
|
-
console.
|
525
|
-
console.
|
524
|
+
console.error("error getting content chunks err.response: ", err.response)
|
525
|
+
console.error("error getting content chunks err.data: ", err.data)
|
526
526
|
return res.status(500).send({ success: false, error: err });
|
527
527
|
})
|
528
528
|
|
@@ -961,6 +961,9 @@ router.post('/', async (req, res) => {
|
|
961
961
|
}
|
962
962
|
else {
|
963
963
|
|
964
|
+
delete raw.ok;
|
965
|
+
delete raw.$clusterTime;
|
966
|
+
delete raw.operationTime;
|
964
967
|
res.status(200).send(raw);
|
965
968
|
|
966
969
|
let saved_kb = raw.value;
|
@@ -1105,8 +1108,6 @@ router.post('/multi', upload.single('uploadFile'), async (req, res) => {
|
|
1105
1108
|
}
|
1106
1109
|
})
|
1107
1110
|
|
1108
|
-
console.log("kbs: ", kbs);
|
1109
|
-
|
1110
1111
|
saveBulk(operations, kbs, project_id).then((result) => {
|
1111
1112
|
|
1112
1113
|
let ns = namespaces.find(n => n.id === namespace_id);
|
@@ -1116,7 +1117,6 @@ router.post('/multi', upload.single('uploadFile'), async (req, res) => {
|
|
1116
1117
|
resources = resources.map(({ _id, scrape_options, ...rest }) => {
|
1117
1118
|
return { id: _id, webhook: webhook, parameters_scrape_type_4: scrape_options, engine: engine, ...rest}
|
1118
1119
|
});
|
1119
|
-
console.log("resources to be sent to worker: ", resources);
|
1120
1120
|
winston.verbose("resources to be sent to worker: ", resources);
|
1121
1121
|
|
1122
1122
|
scheduleScrape(resources);
|
@@ -1183,7 +1183,6 @@ router.post('/csv', upload.single('uploadFile'), async (req, res) => {
|
|
1183
1183
|
let question = data[0];
|
1184
1184
|
let answer = data[1];
|
1185
1185
|
|
1186
|
-
console.log("data. ", data)
|
1187
1186
|
kbs.push({
|
1188
1187
|
id_project: project_id,
|
1189
1188
|
name: question,
|
package/routes/request.js
CHANGED
@@ -744,7 +744,7 @@ router.post('/:requestid/email/send',
|
|
744
744
|
winston.debug("request_id: " + request_id);
|
745
745
|
|
746
746
|
let subject = req.body.subject;
|
747
|
-
winston.
|
747
|
+
winston.debug("subject: " + subject);
|
748
748
|
|
749
749
|
winston.debug("req.project", req.project);
|
750
750
|
|
package/test/app-test.js
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
process.env.NODE_ENV = 'test';
|
2
|
+
|
3
|
+
let chai = require('chai');
|
4
|
+
let chaiHttp = require('chai-http');
|
5
|
+
let server = require('../app');
|
6
|
+
let should = chai.should();
|
7
|
+
const userService = require('../services/userService');
|
8
|
+
const projectService = require('../services/projectService');
|
9
|
+
|
10
|
+
let log = false;
|
11
|
+
|
12
|
+
let expect = chai.expect;
|
13
|
+
let assert = chai.assert;
|
14
|
+
|
15
|
+
chai.use(chaiHttp);
|
16
|
+
|
17
|
+
describe('Root Test', () => {
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Try to perform a request with an invalid id project.
|
21
|
+
* A fake id or non existent mongo id (like user id) is passed.
|
22
|
+
* This test must respond with status 400 and with an error.
|
23
|
+
*/
|
24
|
+
it("Wrong request url", (done) => {
|
25
|
+
|
26
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
27
|
+
var pwd = "pwd";
|
28
|
+
|
29
|
+
userService.signup(email, pwd, "Test Firstname", "Test Lastname").then((savedUser) => {
|
30
|
+
projectService.create("test-root-project", savedUser._id).then((savedProject) => {
|
31
|
+
|
32
|
+
let fake_id_project = "fake1234"
|
33
|
+
|
34
|
+
chai.request(server)
|
35
|
+
//.get('/' + savedUser._id + '/faq_kb')
|
36
|
+
.get('/' + fake_id_project + '/faq_kb')
|
37
|
+
.auth(email, pwd)
|
38
|
+
.end((err, res) => {
|
39
|
+
if (err) { console.error("err: ", err); }
|
40
|
+
if (log) { console.log("res.body", res.body); }
|
41
|
+
|
42
|
+
res.should.have.status(400);
|
43
|
+
assert.notEqual(res.body.error, null);
|
44
|
+
expect(res.body.error).to.equal("Project not found with id: " + fake_id_project)
|
45
|
+
done();
|
46
|
+
})
|
47
|
+
})
|
48
|
+
})
|
49
|
+
}).timeout(5000)
|
50
|
+
})
|