@tiledesk/tiledesk-server 2.3.76 → 2.3.77

Sign up to get free protection for your applications and to get access to all the features.
package/models/faq_kb.js CHANGED
@@ -3,6 +3,9 @@ var Schema = mongoose.Schema;
3
3
  const uuidv4 = require('uuid/v4');
4
4
  var winston = require('../config/winston');
5
5
 
6
+ var defaultFullTextLanguage = process.env.DEFAULT_FULLTEXT_INDEX_LANGUAGE || "none";
7
+
8
+
6
9
  var Faq_kbSchema = new Schema({
7
10
  name: {
8
11
  type: String,
@@ -101,6 +104,8 @@ Faq_kbSchema.virtual('fullName').get(function () {
101
104
  Faq_kbSchema.index({certified: 1, public: 1}); //suggested by atlas
102
105
 
103
106
 
107
+ Faq_kbSchema.index({name: 'text', description: 'text', subject: 'text', "tags": 'text'},
108
+ {"name":"faqkb_fulltext","default_language": defaultFullTextLanguage,"language_override": "language"}); // schema level
104
109
 
105
110
 
106
111
  var faq_kb = mongoose.model('faq_kb', Faq_kbSchema);
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.3.76",
4
+ "version": "2.3.77",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -43,8 +43,8 @@
43
43
  "@tiledesk/tiledesk-json-rules-engine": "^4.0.3",
44
44
  "@tiledesk/tiledesk-kaleyra-proxy": "^0.1.6",
45
45
  "@tiledesk/tiledesk-rasa-connector": "^1.0.10",
46
- "@tiledesk/tiledesk-tybot-connector": "^0.1.53",
47
- "@tiledesk/tiledesk-whatsapp-connector": "^0.1.19",
46
+ "@tiledesk/tiledesk-tybot-connector": "^0.1.55",
47
+ "@tiledesk/tiledesk-whatsapp-connector": "^0.1.24",
48
48
  "amqplib": "^0.5.5",
49
49
  "app-root-path": "^3.0.0",
50
50
  "bcrypt-nodejs": "0.0.3",
@@ -423,7 +423,15 @@
423
423
  winston.debug("Deleted cache for faq_kb.update secret",reply);
424
424
  winston.verbose("Deleted cache for faq_kb.update secret",{err:err});
425
425
  });
426
-
426
+
427
+ // without project for tilebot
428
+ key = "faq_kbs:id:"+faq_kb._id;
429
+ winston.verbose("Deleting cache for faq_kb.update without project for tilebot with key: " + key);
430
+ client.del(key, function (err, reply) {
431
+ winston.debug("Deleted cache for faq_kb.update without project for tilebot ",reply);
432
+ winston.verbose("Deleted cache for faq_kb.update without project for tilebot ",{err:err});
433
+ });
434
+
427
435
  // TODO invalidate widgets here
428
436
  winston.verbose("Deleting widgets cache for faqbot.update");
429
437
  invalidateWidgets(client, faq_kb.id_project); //TESTED
@@ -446,6 +454,15 @@
446
454
  client.del(key, function (err, reply) {
447
455
  winston.debug("Deleted cache for faq_kb.delete secret",reply);
448
456
  winston.verbose("Deleted cache for faq_kb.delete secret",{err:err});
457
+ });
458
+
459
+
460
+ // without project for tilebot
461
+ key = "faq_kbs:id:"+faq_kb._id;
462
+ winston.verbose("Deleting cache for faq_kb.update without project for tilebot with key: " + key);
463
+ client.del(key, function (err, reply) {
464
+ winston.debug("Deleted cache for faq_kb.update without project for tilebot ",reply);
465
+ winston.verbose("Deleted cache for faq_kb.update without project for tilebot ",{err:err});
449
466
  });
450
467
 
451
468
  // TODO invalidate widgets here
@@ -13,17 +13,21 @@ class Listener {
13
13
  winston.debug("kaleyra config databaseUri: " + config.databaseUri);
14
14
  }
15
15
 
16
- kaleyra.startApp({
17
- MONGODB_URL: config.databaseUri,
18
- API_URL: apiUrl,
19
- BASE_URL: apiUrl + "/modules/kaleyra",
20
- APPS_API_URL: apiUrl + "/modules/apps",
21
- KALEYRA_API_URL: process.env.KALEYRA_API_URL,
22
- API_KEY: process.env.API_KEY,
23
- log: process.env.KALEYRA_LOG
24
- }, () => {
25
- winston.info("Tiledesk Kaleyra proxy server succesfully started.");
26
- })
16
+ if (!process.env.KALEYRA_API_URL || !process.env.API_KEY) {
17
+ winston.info("Skip Kaleyra startApp")
18
+ } else {
19
+ kaleyra.startApp({
20
+ MONGODB_URL: config.databaseUri,
21
+ API_URL: apiUrl,
22
+ BASE_URL: apiUrl + "/modules/kaleyra",
23
+ APPS_API_URL: apiUrl + "/modules/apps",
24
+ KALEYRA_API_URL: process.env.KALEYRA_API_URL,
25
+ API_KEY: process.env.API_KEY,
26
+ log: process.env.KALEYRA_LOG
27
+ }, () => {
28
+ winston.info("Tiledesk Kaleyra proxy server succesfully started.");
29
+ })
30
+ }
27
31
  }
28
32
  }
29
33
 
@@ -13,16 +13,20 @@ class Listener {
13
13
  winston.debug("whatsapp config databaseUri: " + config.databaseUri);
14
14
  }
15
15
 
16
- whatsapp.startApp({
17
- MONGODB_URL: config.databaseUri,
18
- API_URL: apiUrl,
19
- GRAPH_URL: process.env.META_GRAPH_URL || config.graphUrl,
20
- BASE_URL: apiUrl + "/modules/whatsapp",
21
- APPS_API_URL: apiUrl + "/modules/apps",
22
- log: process.env.WHATSAPP_LOG
23
- }, () => {
24
- winston.info("Tiledesk WhatsApp Connector proxy server succesfully started.");
25
- })
16
+ if (!process.env.GRAPH_URL || !config.graphUrl) {
17
+ winston.info("Skip WhatsApp startApp")
18
+ } else {
19
+ whatsapp.startApp({
20
+ MONGODB_URL: config.databaseUri,
21
+ API_URL: apiUrl,
22
+ GRAPH_URL: process.env.META_GRAPH_URL || config.graphUrl,
23
+ BASE_URL: apiUrl + "/modules/whatsapp",
24
+ APPS_API_URL: apiUrl + "/modules/apps",
25
+ log: process.env.WHATSAPP_LOG
26
+ }, () => {
27
+ winston.info("Tiledesk WhatsApp Connector proxy server succesfully started.");
28
+ })
29
+ }
26
30
 
27
31
  }
28
32
  }
package/routes/faq_kb.js CHANGED
@@ -319,7 +319,6 @@ router.delete('/:faq_kbid', function (req, res) {
319
319
 
320
320
  winston.debug(req.body);
321
321
 
322
-
323
322
  Faq_kb.remove({ _id: req.params.faq_kbid }, function (err, faq_kb) {
324
323
  if (err) {
325
324
  return res.status(500).send({ success: false, msg: 'Error deleting object.' });
@@ -393,12 +392,23 @@ router.get('/', function (req, res) {
393
392
  query.type = { $ne: "identity" }
394
393
  }
395
394
 
396
- winston.debug("query", query);
395
+ var search_obj = {"$search": req.query.text};
396
+
397
+ if (req.query.text) {
398
+ if (req.query.language) {
399
+ search_obj["$language"] = req.query.language;
400
+ }
401
+ query.$text = search_obj;
402
+ }
403
+
404
+
405
+
406
+ winston.info("query", query);
397
407
 
398
408
  Faq_kb.find(query, function (err, faq_kb) {
399
409
  if (err) {
400
410
  winston.error('GET FAQ-KB ERROR ', err)
401
- return (err);
411
+ return res.status(500).send({ success: false, message: "Unable to get chatbots" });
402
412
  }
403
413
 
404
414
  res.json(faq_kb);
@@ -177,6 +177,7 @@ class FaqService {
177
177
  id_faq_kb: faq_kb_id,
178
178
  question: faq.question,
179
179
  answer: faq.answer,
180
+ actions: faq.actions,
180
181
  reply: faq.reply,
181
182
  intent_display_name: faq.intent_display_name,
182
183
  language: "en",