@tiledesk/tiledesk-server 2.13.30 → 2.13.32

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,6 +5,9 @@
5
5
  🚀 IN PRODUCTION 🚀
6
6
  (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
7
7
 
8
+ # 2.13.32
9
+ - Fix bug on create chatbot from public template
10
+
8
11
  # 2.13.31
9
12
  - Added default context for general LLM
10
13
  - Updated tybot-connector to 2.0.35
@@ -125,7 +125,7 @@
125
125
  "GUEST_LABEL": "Ospite",
126
126
  "ALL_AGENTS_OFFLINE_LABEL": "Tutti gli operatori sono offline al momento",
127
127
  "LABEL_LOADING": "Caricamento...",
128
- "CALLOUT_TITLE_PLACEHOLDER": "Bisogno di aiuto?",
128
+ "CALLOUT_TITLE_PLACEHOLDER": "🖐 Bisogno di aiuto?",
129
129
  "CALLOUT_MSG_PLACEHOLDER": "Clicca qui e inizia a chattare con noi!",
130
130
  "CUSTOMER_SATISFACTION": "Valutazione servizio",
131
131
  "YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE": "il tuo giudizio sul nostro servizio clienti",
@@ -228,7 +228,7 @@
228
228
  "GUEST_LABEL": "Hôte",
229
229
  "ALL_AGENTS_OFFLINE_LABEL": "Tous les opérateurs sont actuellement hors ligne",
230
230
  "LABEL_LOADING": "Chargement en cours ...",
231
- "CALLOUT_TITLE_PLACEHOLDER": "Besoin d'aide?",
231
+ "CALLOUT_TITLE_PLACEHOLDER": "🖐 Besoin d'aide?",
232
232
  "CALLOUT_MSG_PLACEHOLDER": "Cliquez ici et commencez à discuter avec nous!",
233
233
  "CUSTOMER_SATISFACTION": "Évaluation des services",
234
234
  "YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE": "votre avis sur notre service client",
@@ -331,7 +331,7 @@
331
331
  "GUEST_LABEL": "Huésped",
332
332
  "ALL_AGENTS_OFFLINE_LABEL": "Todos los operadores están desconectados en este momento.",
333
333
  "LABEL_LOADING": "Cargando...",
334
- "CALLOUT_TITLE_PLACEHOLDER": "¿Necesitas ayuda?",
334
+ "CALLOUT_TITLE_PLACEHOLDER": "🖐 ¿Necesitas ayuda?",
335
335
  "CALLOUT_MSG_PLACEHOLDER": "¡Haz clic aquí y comienza a chatear con nosotros!",
336
336
  "CUSTOMER_SATISFACTION": "La satisfacción del cliente",
337
337
  "YOUR_OPINION_ON_OUR_CUSTOMER_SERVICE": "su opinión sobre nuestro servicio al cliente",
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.13.30",
4
+ "version": "2.13.32",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -49,7 +49,7 @@
49
49
  "@tiledesk/tiledesk-rasa-connector": "^1.0.10",
50
50
  "@tiledesk/tiledesk-sms-connector": "^0.1.11",
51
51
  "@tiledesk/tiledesk-telegram-connector": "^0.1.14",
52
- "@tiledesk/tiledesk-tybot-connector": "^2.0.35",
52
+ "@tiledesk/tiledesk-tybot-connector": "^2.0.36",
53
53
  "@tiledesk/tiledesk-voice-twilio-connector": "^0.1.22",
54
54
  "@tiledesk/tiledesk-vxml-connector": "^0.1.87",
55
55
  "@tiledesk/tiledesk-whatsapp-connector": "1.0.11",
package/routes/faq_kb.js CHANGED
@@ -966,14 +966,24 @@ router.get('/exportjson/:id_faq_kb', roleChecker.hasRole('admin'), (req, res) =>
966
966
  const chatbot_id = req.params.id_faq_kb;
967
967
  const id_project = req.projectid;
968
968
 
969
- Faq_kb.findOne({ _id: chatbot_id, id_project: id_project }, (err, faq_kb) => {
969
+ Faq_kb.findOne({ _id: chatbot_id }, (err, faq_kb) => {
970
970
  if (err) {
971
971
  winston.error('GET FAQ-KB ERROR ', err)
972
972
  return res.status(500).send({ success: false, msg: 'Error getting bot.' });
973
973
  }
974
974
 
975
975
  if (!faq_kb) {
976
- return res.status(404).send({ success: false, msg: "Chatbot not found with id " + chatbot_id + " for project " + id_project });
976
+ return res.status(404).send({ success: false, msg: "Chatbot not found with id " + chatbot_id });
977
+ }
978
+
979
+ const isPublic = faq_kb.public === true;
980
+ const isOwner = faq_kb.id_project === id_project;
981
+
982
+ if (!isPublic && !isOwner) {
983
+ return res.status(403).send({
984
+ success: false,
985
+ msg: "Chatbot not found with id " + chatbot_id + " for project " + id_project
986
+ });
977
987
  }
978
988
 
979
989
  winston.debug('FAQ-KB: ', faq_kb)
package/routes/kb.js CHANGED
@@ -318,11 +318,13 @@ router.post('/qa', async (req, res) => {
318
318
  } else {
319
319
  try {
320
320
  let key = await integrationService.getKeyFromIntegration(project_id, data.llm);
321
-
321
+ console.log("key from integration: ", key);
322
322
  if (!key) {
323
+ console.log("key not found in integration")
323
324
  if (data.llm === 'openai') {
324
325
  data.gptkey = process.env.GPTKEY;
325
326
  publicKey = true;
327
+ console.log("set gptkey to " + data.gptkey + " and publicKey to " + publicKey);
326
328
  } else {
327
329
  return res.status(404).send({ success: false, error: `Invalid or empty key provided for ${data.llm}` });
328
330
  }
@@ -409,6 +411,7 @@ router.post('/qa', async (req, res) => {
409
411
  }
410
412
  obj.multiplier = multiplier;
411
413
  obj.tokens = answer.prompt_token_size;
414
+ console.log("is publicKey TRUE: ", obj)
412
415
 
413
416
  let incremented_key = quoteManager.incrementTokenCount(req.project, obj);
414
417
  winston.verbose("incremented_key: ", incremented_key);
@@ -97,7 +97,9 @@ class QuoteManager {
97
97
  }
98
98
 
99
99
  let tokens = data.tokens * data.multiplier;
100
+ console.log("incr tokens by ", tokens);
100
101
  await this.tdCache.incrbyfloat(key, tokens);
102
+ console.log("token increased");
101
103
  // await this.tdCache.incrby(key, tokens);
102
104
  this.sendEmailIfQuotaExceeded(project, data, 'tokens', key);
103
105
  return key;
package/utils/TdCache.js CHANGED
@@ -29,6 +29,7 @@ class TdCache {
29
29
  // });
30
30
  this.client.on('ready',function() {
31
31
  resolve();
32
+ // onsole.log("Redis is ready.");
32
33
  if (callback) {
33
34
  callback();
34
35
  }
@@ -75,6 +76,11 @@ class TdCache {
75
76
  });
76
77
  }
77
78
 
79
+
80
+
81
+
82
+
83
+
78
84
  async incr(key) {
79
85
  // console.log("incr key:", key)
80
86
  return new Promise( async (resolve, reject) => {
@@ -107,8 +113,8 @@ class TdCache {
107
113
  return new Promise( async (resolve, reject) => {
108
114
  try {
109
115
  await this.client.incrbyfloat(key, increment);
116
+ console.log("incrbyfloat OK")
110
117
  }
111
-
112
118
  catch(error) {
113
119
  console.error("Error on incrby: ", error);
114
120
  reject(error);
@@ -262,6 +268,11 @@ class TdCache {
262
268
  return resolve(result);
263
269
  })
264
270
  }
271
+
272
+
273
+ getClient() {
274
+ return this.client;
275
+ }
265
276
  }
266
277
 
267
278
  module.exports = { TdCache };