@tiledesk/tiledesk-tybot-connector 2.0.15 → 2.0.16-rc1

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +28 -3
  2. package/Logger.js +13 -3
  3. package/engine/mock/MockBotsDataSource.js +1 -2
  4. package/index.js +3 -0
  5. package/package.json +2 -2
  6. package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +29 -11
  7. package/tiledeskChatbotPlugs/directives/DirAddKbContent.js +20 -21
  8. package/tiledeskChatbotPlugs/directives/DirAddTags.js +5 -6
  9. package/tiledeskChatbotPlugs/directives/DirAiPrompt.js +7 -8
  10. package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +6 -7
  11. package/tiledeskChatbotPlugs/directives/DirAssistant.js +1 -2
  12. package/tiledeskChatbotPlugs/directives/DirBrevo.js +1 -2
  13. package/tiledeskChatbotPlugs/directives/DirCaptureUserReply.js +4 -5
  14. package/tiledeskChatbotPlugs/directives/DirClearTranscript.js +1 -2
  15. package/tiledeskChatbotPlugs/directives/DirClose.js +2 -3
  16. package/tiledeskChatbotPlugs/directives/DirCode.js +1 -2
  17. package/tiledeskChatbotPlugs/directives/DirCondition.js +3 -4
  18. package/tiledeskChatbotPlugs/directives/DirContactUpdate.js +1 -2
  19. package/tiledeskChatbotPlugs/directives/DirCustomerio.js +1 -2
  20. package/tiledeskChatbotPlugs/directives/DirDeleteVariable.js +1 -2
  21. package/tiledeskChatbotPlugs/directives/DirDepartment.js +3 -4
  22. package/tiledeskChatbotPlugs/directives/DirFlowLog.js +7 -7
  23. package/tiledeskChatbotPlugs/directives/DirGptTask.js +4 -5
  24. package/tiledeskChatbotPlugs/directives/DirHubspot.js +1 -2
  25. package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +1 -2
  26. package/tiledeskChatbotPlugs/directives/DirIfOpenHours.js +3 -4
  27. package/tiledeskChatbotPlugs/directives/DirIntent.js +1 -0
  28. package/tiledeskChatbotPlugs/directives/DirJSONCondition.js +4 -5
  29. package/tiledeskChatbotPlugs/directives/DirMake.js +1 -2
  30. package/tiledeskChatbotPlugs/directives/DirMoveToAgent.js +1 -2
  31. package/tiledeskChatbotPlugs/directives/DirMoveToUnassigned.js +1 -2
  32. package/tiledeskChatbotPlugs/directives/DirQapla.js +1 -2
  33. package/tiledeskChatbotPlugs/directives/DirRandomReply.js +1 -2
  34. package/tiledeskChatbotPlugs/directives/DirReplaceBot.js +1 -2
  35. package/tiledeskChatbotPlugs/directives/DirReplaceBotV2.js +1 -2
  36. package/tiledeskChatbotPlugs/directives/DirReplaceBotV3.js +1 -2
  37. package/tiledeskChatbotPlugs/directives/DirReply.js +4 -5
  38. package/tiledeskChatbotPlugs/directives/DirReplyV2.js +1 -2
  39. package/tiledeskChatbotPlugs/directives/DirSendEmail.js +1 -2
  40. package/tiledeskChatbotPlugs/directives/DirSendWhatsapp.js +1 -2
  41. package/tiledeskChatbotPlugs/directives/DirSetAttributeV2.js +1 -2
  42. package/tiledeskChatbotPlugs/directives/DirWait.js +2 -3
  43. package/tiledeskChatbotPlugs/directives/DirWebRequestV2.js +8 -9
  44. package/tiledeskChatbotPlugs/directives/DirWebResponse.js +2 -3
  45. package/tiledeskChatbotPlugs/directives/DirWhatsappByAttribute.js +1 -2
  46. package/tiledeskChatbotPlugs/directives/Directives.js +1 -0
  47. package/utils/TiledeskChatbotUtil.js +2 -21
  48. package/TdCache copy.js +0 -242
  49. package/tiledeskChatbotPlugs/directives/DirWebRequestV2_old.js +0 -418
package/CHANGELOG.md CHANGED
@@ -5,8 +5,6 @@
5
5
  available on:
6
6
  ▶️ https://www.npmjs.com/package/@tiledesk/tiledesk-tybot-connector
7
7
 
8
- # 2.0.9
9
-
10
8
  # 2.0.9-rc1
11
9
  - removed: speech-to-text management
12
10
 
@@ -20,6 +18,8 @@ available on:
20
18
 
21
19
  # v0.5.0
22
20
  - added: AI_ENDPOINT env var
21
+
22
+ # v0.5.0-rc1
23
23
  - added: ability to get 'none' as bodytype in webresponse
24
24
 
25
25
  # v0.4.2
@@ -34,6 +34,19 @@ available on:
34
34
  - changed: refactoring of DIrWebRequestv2
35
35
  - bug-fixed: erro while parsing webrequestv2 body
36
36
 
37
+ # v0.3.5-rc4
38
+ - added: webhook action (same as intent one)
39
+
40
+ # v0.3.5-rc3
41
+ - bug-fixed: jsonBody parse error in web-request-v2
42
+
43
+ # v0.3.5-rc2
44
+ - bug-fixed: cannot set status of undefined reading res.status in DirAssistant
45
+
46
+ # v0.3.5-rc1
47
+ - changed: refactoring web-request-v2
48
+ - bug-fixed: jsonBody parse error in web-request-v2
49
+
37
50
  # v0.3.4
38
51
  -bug-fixed: slit is undefined in TiledeskChatbotUtils
39
52
 
@@ -43,6 +56,18 @@ available on:
43
56
  # v0.3.2
44
57
  - bug-fixed: minor improvement
45
58
 
59
+ # v0.2.153-rc9
60
+ - changed: updated tiledesk-multi-worker to 0.2.1-rc2
61
+
62
+ # v0.2.153-rc8
63
+ - added: fixToken function in TiledeskService utils class
64
+
65
+ # v0.2.153-rc4
66
+ - log added
67
+
68
+ # v0.2.153-rc3
69
+ - added: specchToText function to transcript audio file
70
+
46
71
  # v0.2.153-rc1
47
72
  - changed: context for gpt-40 and gpt-40-mini
48
73
 
@@ -466,7 +491,7 @@ available on:
466
491
  - Added AskGPTV2 action
467
492
 
468
493
  # v0.2.49
469
- - resplacebotv2, added "/" + blockName (so the blockname will be implicitly executed), removing the need to specify the "/" in the body of the replacebot editor
494
+ - resplacebotv2, added "/" + blockName (so the blockname will be implicitly Executed"), removing the need to specify the "/" in the body of the replacebot editor
470
495
  - Never add "guest#" as lead userFullname
471
496
 
472
497
  # v0.2.48
package/Logger.js CHANGED
@@ -12,6 +12,8 @@ let publisher = new Publisher(AMQP_MANAGER_URL, {
12
12
  exchange: "amq.topic"
13
13
  })
14
14
 
15
+ console.log("LOGGER publisher: ", publisher);
16
+
15
17
  class Logger {
16
18
 
17
19
  constructor(config) {
@@ -65,6 +67,11 @@ class Logger {
65
67
  return this.base('debug', log);
66
68
  }
67
69
 
70
+ native(...args) {
71
+ let log = this.formatLog(args);
72
+ return this.base('native', log);
73
+ }
74
+
68
75
  base(level, text) {
69
76
  if (!this.request_id || !publisher) {
70
77
  console.log("Return because request or publisher is undefined", this.request_id, publisher);
@@ -87,6 +94,7 @@ class Logger {
87
94
  }
88
95
 
89
96
  let topic = LOGS_BASE_ROUTING_KEY + `.${this.request_id}`;
97
+ console.log("LOGGER publishing on topic ", topic)
90
98
  publisher.publish(data, topic);
91
99
  return;
92
100
  }
@@ -99,15 +107,17 @@ class Logger {
99
107
 
100
108
  // Substitute methods with empty function if flow flogs are disabled
101
109
  _disableMethods() {
102
- const methods = ['error', 'warn', 'info', 'debug'];
110
+ const methods = ['error', 'warn', 'info', 'debug', 'native'];
103
111
  methods.forEach(method => {
104
112
  this[method] = () => { };
105
113
  });
106
114
  }
107
115
 
108
116
  _disableDebugMethods() {
109
- const method = 'debug';
110
- this[method] = () => { };
117
+ const methods = ['debug', 'native'];
118
+ methods.forEach(method => {
119
+ this[method] = () => { };
120
+ });
111
121
  }
112
122
 
113
123
  }
@@ -24,8 +24,7 @@ class MockBotsDataSource {
24
24
  }catch(err){
25
25
  reject(err);
26
26
  }
27
-
28
- })
27
+ })
29
28
  }
30
29
 
31
30
  async getBotByIdCache(botId, tdcache) {
package/index.js CHANGED
@@ -98,6 +98,9 @@ router.post('/ext/:botid', async (req, res) => {
98
98
  Promise.reject(err);
99
99
  return;
100
100
  });
101
+
102
+ winston.debug("(tybotRoute) Bot found: ", bot)
103
+
101
104
 
102
105
  let intentsMachine;
103
106
  let backupMachine;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "2.0.15",
3
+ "version": "2.0.16-rc1",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,7 +15,7 @@
15
15
  "@tiledesk/tiledesk-chatbot-client": "^0.5.30",
16
16
  "@tiledesk/tiledesk-chatbot-util": "^0.8.39",
17
17
  "@tiledesk/tiledesk-client": "^0.10.13",
18
- "@tiledesk/tiledesk-multi-worker": "^0.3.1-rc10",
18
+ "@tiledesk/tiledesk-multi-worker": "^0.3.1",
19
19
  "accept-language-parser": "^1.5.0",
20
20
  "app-root-path": "^3.1.0",
21
21
  "axios": "^1.7.7",
@@ -54,13 +54,13 @@ const { DirMoveToUnassigned } = require('./directives/DirMoveToUnassigned');
54
54
  const { DirAddTags } = require('./directives/DirAddTags');
55
55
  const { DirSendWhatsapp } = require('./directives/DirSendWhatsapp');
56
56
  const { DirReplaceBotV3 } = require('./directives/DirReplaceBotV3');
57
- const { DirAiTask, DirAiPrompt } = require('./directives/DirAiPrompt');
57
+ const { DirAiPrompt } = require('./directives/DirAiPrompt');
58
58
  const { DirWebResponse } = require('./directives/DirWebResponse');
59
59
  const { DirConnectBlock } = require('./directives/DirConnectBlock');
60
+ const { DirAddKbContent } = require('./directives/DirAddKbContent');
61
+ const { DirFlowLog } = require('./directives/DirFlowLog');
60
62
 
61
63
  const winston = require('../utils/winston');
62
- const { DirFlowLog } = require('./directives/DirFlowLog');
63
- const { DirAddKbContent } = require('./directives/DirAddKbContent');
64
64
 
65
65
  class DirectivesChatbotPlug {
66
66
 
@@ -219,14 +219,13 @@ class DirectivesChatbotPlug {
219
219
  directive_name = directive.name.toLowerCase();
220
220
  }
221
221
  if (directive && directive.action) {
222
- const action_id = directive.action["_tdActionId"];
223
- const locked_action_id = await this.chatbot.currentLockedAction(this.supportRequest.request_id);
224
- if ( locked_action_id && (locked_action_id !== action_id) ) {
225
- let next_dir = await this.nextDirective(this.directives);
226
- this.process(next_dir);
227
- return;
228
- }
229
-
222
+ const action_id = directive.action["_tdActionId"];
223
+ const locked_action_id = await this.chatbot.currentLockedAction(this.supportRequest.request_id);
224
+ if ( locked_action_id && (locked_action_id !== action_id) ) {
225
+ let next_dir = await this.nextDirective(this.directives);
226
+ this.process(next_dir);
227
+ return;
228
+ }
230
229
  }
231
230
  if (directive == null || (directive !== null && directive["name"] === undefined)) {
232
231
  winston.debug("(DirectivesChatbotPlug) stop process(). directive is (null?): ", directive);
@@ -704,6 +703,19 @@ class DirectivesChatbotPlug {
704
703
  }
705
704
  });
706
705
  }
706
+ else if (directive_name === Directives.WEBHOOK) {
707
+ // console.log(".....DirIntent")
708
+ new DirIntent(context).execute(directive, async (stop) => {
709
+ if (stop) {
710
+ if (context.log) { console.log("Stopping Actions on:", JSON.stringify(directive));}
711
+ this.theend();
712
+ }
713
+ else {
714
+ let next_dir = await this.nextDirective(this.directives);
715
+ this.process(next_dir);
716
+ }
717
+ });
718
+ }
707
719
  else if (directive_name === Directives.WEB_RESPONSE) {
708
720
  new DirWebResponse(context).execute(directive, async () => {
709
721
  let next_dir = await this.nextDirective(this.directives);
@@ -716,6 +728,12 @@ class DirectivesChatbotPlug {
716
728
  this.process(next_dir);
717
729
  })
718
730
  }
731
+ else if (directive_name === Directives.ADD_KB_CONTENT) {
732
+ new DirAddKbContent(context).execute(directive, async () => {
733
+ let next_dir = await this.nextDirective(this.directives);
734
+ this.process(next_dir);
735
+ });
736
+ }
719
737
  else {
720
738
  let next_dir = await this.nextDirective(this.directives);
721
739
  this.process(next_dir);
@@ -32,20 +32,19 @@ class DirAddKbContent {
32
32
  }
33
33
 
34
34
  execute(directive, callback) {
35
- this.logger.info("Execute AskKnowledgeBase action")
36
- winston.debug("DirAskGPTV2 directive: ", directive);
35
+ winston.debug("DirAddKbContent directive: ", directive);
37
36
  let action;
38
37
  if (directive.action) {
39
38
  action = directive.action;
40
39
  }
41
40
  else {
42
41
  this.logger.error("Incorrect action for ", directive.name, directive)
43
- winston.debug("DirAskGPTV2 Incorrect directive: ", directive);
42
+ winston.debug("DirAddKbContent Incorrect directive: ", directive);
44
43
  callback();
45
44
  return;
46
45
  }
47
46
  this.go(action, (stop) => {
48
- this.logger.info("Acion AskKnowledgeBase completed");
47
+ this.logger.native("[Add to KnwoledgeBase] Executed");
49
48
  callback(stop);
50
49
  })
51
50
  }
@@ -86,7 +85,7 @@ class DirAddKbContent {
86
85
 
87
86
  let key = await integrationService.getKeyFromIntegrations(this.projectId, 'openai', this.token);
88
87
  if (!key) {
89
- this.logger.debug("[DirAddKbContent] OpenAI key not found in Integration. Using shared OpenAI key");
88
+ this.logger.native("[Add to KnwoledgeBase] OpenAI key not found in Integration. Using shared OpenAI key");
90
89
  winston.verbose("[DirAddKbContent] - Key not found in Integrations. Searching in kb settings...");
91
90
  key = await this.getKeyFromKbSettings();
92
91
  }
@@ -96,7 +95,7 @@ class DirAddKbContent {
96
95
  key = process.env.GPTKEY;
97
96
  publicKey = true;
98
97
  } else {
99
- this.logger.debug("[DirAddKbContent] use your own OpenAI key")
98
+ this.logger.native("[Add to KnwoledgeBase] Use your own OpenAI key")
100
99
  }
101
100
 
102
101
  if (!key) {
@@ -109,7 +108,7 @@ class DirAddKbContent {
109
108
  if (publicKey === true) {
110
109
  let keep_going = await this.checkQuoteAvailability();
111
110
  if (keep_going === false) {
112
- this.logger.warn("[DirAddKbContent] Tokens quota exceeded. Skip the action")
111
+ this.logger.warn("[Add to KnwoledgeBase] Tokens quota exceeded. Skip the action")
113
112
  winston.verbose("[DirAddKbContent] - Quota exceeded for tokens. Skip the action")
114
113
  await this.chatbot.addParameter("flowError", "[DirAddKbContent] Error: tokens quota exceeded");
115
114
  callback(true);
@@ -122,17 +121,17 @@ class DirAddKbContent {
122
121
  if (action.namespaceAsName) {
123
122
  // Namespace could be an attribute
124
123
  const filled_namespace = filler.fill(action.namespace, requestVariables)
125
- this.logger.debug("[DirAddKbContent] Searching namespace by name ", filled_namespace);
124
+ this.logger.native("[Add to KnwoledgeBase] Searching namespace by name ", filled_namespace);
126
125
  ns = await this.getNamespace(filled_namespace, null);
127
126
  namespace = ns?.id;
128
127
  winston.verbose("[DirAddKbContent] - Retrieved namespace id from name " + namespace);
129
128
  } else {
130
- this.logger.debug("[DirAddKbContent] Searching namespace by id ", namespace);
129
+ this.logger.native("[Add to KnwoledgeBase] Searching namespace by id ", namespace);
131
130
  ns = await this.getNamespace(null, namespace);
132
131
  }
133
132
 
134
133
  if (!ns) {
135
- this.logger.error("[DirAddKbContent] Namespace not found");
134
+ this.logger.error("[Add to KnwoledgeBase] Namespace not found");
136
135
  await this.chatbot.addParameter("flowError", "[DirAddKbContent] Error: namespace not found");
137
136
  callback();
138
137
  return;
@@ -145,7 +144,7 @@ class DirAddKbContent {
145
144
  }
146
145
 
147
146
  if (!namespace) {
148
- this.logger.error("[DirAddKbContent] Namespace is undefined")
147
+ this.logger.error("[Add to KnwoledgeBase] Namespace is undefined")
149
148
  winston.verbose("[DirAddKbContent] - Error: namespace is undefined")
150
149
  await this.chatbot.addParameter("flowError", "[DirAddKbContent] Error: namespace is undefined");
151
150
  callback(true);
@@ -177,7 +176,7 @@ class DirAddKbContent {
177
176
  HTTPREQUEST, async (err, resbody) => {
178
177
 
179
178
  if (err) {
180
- this.logger.error("[DirAddKbContent] error: " + JSON.stringify(err?.response));
179
+ this.logger.error("[Add to KnwoledgeBase] error: " + JSON.stringify(err?.response));
181
180
  winston.error("[DirAddKbContent] error: ", err?.response);
182
181
  if (callback) {
183
182
  callback();
@@ -207,12 +206,12 @@ class DirAddKbContent {
207
206
  },
208
207
  method: "GET"
209
208
  }
210
- winston.debug("DirAskGPTV2 KB HttpRequest", KB_HTTPREQUEST);
209
+ winston.debug("DirAddKbContent KB HttpRequest", KB_HTTPREQUEST);
211
210
 
212
211
  httpUtils.request(
213
212
  KB_HTTPREQUEST, async (err, resbody) => {
214
213
  if (err) {
215
- winston.error("DirAskGPTV2 Get kb settings error ", err?.response?.data);
214
+ winston.error("DirAddKbContent Get kb settings error ", err?.response?.data);
216
215
  resolve(null);
217
216
  } else {
218
217
  if (!resbody.gptkey) {
@@ -237,12 +236,12 @@ class DirAddKbContent {
237
236
  },
238
237
  method: "GET"
239
238
  }
240
- winston.debug("DirAskGPTV2 check quote availability HttpRequest", HTTPREQUEST);
239
+ winston.debug("DirAddKbContent check quote availability HttpRequest", HTTPREQUEST);
241
240
 
242
241
  httpUtils.request(
243
242
  HTTPREQUEST, async (err, resbody) => {
244
243
  if (err) {
245
- winston.error("DirAskGPTV2 Check quote availability err: ", err);
244
+ winston.error("DirAddKbContent Check quote availability err: ", err);
246
245
  resolve(true)
247
246
  } else {
248
247
  if (resbody.isAvailable === true) {
@@ -268,12 +267,12 @@ class DirAddKbContent {
268
267
  json: tokens_usage,
269
268
  method: "POST"
270
269
  }
271
- winston.debug("DirAskGPTV2 update quote HttpRequest ", HTTPREQUEST);
270
+ winston.debug("DirAddKbContent update quote HttpRequest ", HTTPREQUEST);
272
271
 
273
272
  httpUtils.request(
274
273
  HTTPREQUEST, async (err, resbody) => {
275
274
  if (err) {
276
- winston.error("DirAskGPTV2 Increment tokens quote err: ", err);
275
+ winston.error("DirAddKbContent Increment tokens quote err: ", err);
277
276
  reject(false)
278
277
  } else {
279
278
  resolve(true);
@@ -293,14 +292,14 @@ class DirAddKbContent {
293
292
  },
294
293
  method: "GET"
295
294
  }
296
- winston.debug("DirAskGPTV2 get all namespaces HttpRequest", HTTPREQUEST);
295
+ winston.debug("DirAddKbContent get all namespaces HttpRequest", HTTPREQUEST);
297
296
  httpUtils.request(
298
297
  HTTPREQUEST, async (err, namespaces) => {
299
298
  if (err) {
300
- winston.error("DirAskGPTV2 get all namespaces err: ", err);
299
+ winston.error("DirAddKbContent get all namespaces err: ", err);
301
300
  resolve(null)
302
301
  } else {
303
- winston.debug("DirAskGPTV2 get all namespaces resbody: ", namespaces);
302
+ winston.debug("DirAddKbContent get all namespaces resbody: ", namespaces);
304
303
  if (name) {
305
304
  let namespace = namespaces.find(n => n.name === name);
306
305
  resolve(namespace);
@@ -30,7 +30,6 @@ class DirAddTags {
30
30
  }
31
31
 
32
32
  execute(directive, callback) {
33
- this.logger.info("[Add Tag] Executing action")
34
33
  winston.verbose("Execute AddTags action");
35
34
  let action;
36
35
  if (directive.action) {
@@ -43,7 +42,7 @@ class DirAddTags {
43
42
  return;
44
43
  }
45
44
  this.go(action, (stop) => {
46
- this.logger.info("[Add Tag] Action completed");
45
+ this.logger.native("[Add Tag] Executed");
47
46
  callback(stop);
48
47
  })
49
48
  }
@@ -85,7 +84,7 @@ class DirAddTags {
85
84
  if(target === 'request'){
86
85
 
87
86
  let newTags = filled_tags.split(',').filter(tag => tag !== '').map(el => el.trim())
88
- this.logger.debug("[Add Tag] Adding following tags to conversation: ", newTags)
87
+ this.logger.native("[Add Tag] Adding following tags to conversation: ", newTags)
89
88
 
90
89
  if(action.pushToList){
91
90
  newTags.forEach(async (tag) => {
@@ -99,7 +98,7 @@ class DirAddTags {
99
98
 
100
99
  winston.debug('(DirAddTags) UPDATE request with newTags', newTags)
101
100
  let updatedRequest = await this.updateRequestWithTags(newTags)
102
- this.logger.info("[Add Tag] Tags added to conversation")
101
+ this.logger.native("[Add Tag] Tags added to conversation")
103
102
  if(!updatedRequest){
104
103
  callback();
105
104
  return;
@@ -110,7 +109,7 @@ class DirAddTags {
110
109
  /** use case: LEAD */
111
110
  if(target === 'lead'){
112
111
  let newTags = filled_tags.split(',').filter(tag => tag !== '').map(el => el.trim())
113
- this.logger.debug("[Add Tag] Adding following tags to lead: ", newTags)
112
+ this.logger.native("[Add Tag] Adding following tags to lead: ", newTags)
114
113
 
115
114
  let request = await this.tdClient.getRequestById(this.requestId);
116
115
  winston.debug('(DirAddTags) request detail: ', request)
@@ -132,7 +131,7 @@ class DirAddTags {
132
131
 
133
132
  winston.debug('(DirAddTags) UPDATE lead with newTags ', newTags)
134
133
  let updatedLead = await this.updateLeadWithTags(request.lead._id, newTags)
135
- this.logger.info("[Add Tag] Tags added to lead")
134
+ this.logger.native("[Add Tag] Tags added to lead")
136
135
  if(!updatedLead){
137
136
  callback();
138
137
  return;
@@ -33,7 +33,6 @@ class DirAiPrompt {
33
33
  }
34
34
 
35
35
  execute(directive, callback) {
36
- this.logger.info("[AI Prompt] Executing action");
37
36
  winston.verbose("Execute AiPrompt directive");
38
37
  let action;
39
38
  if (directive.action) {
@@ -46,7 +45,7 @@ class DirAiPrompt {
46
45
  return;
47
46
  }
48
47
  this.go(action, (stop) => {
49
- this.logger.info("[AI Prompt] Action completed");
48
+ this.logger.native("[AI Prompt] Executed");
50
49
  callback(stop);
51
50
  })
52
51
  }
@@ -92,7 +91,7 @@ class DirAiPrompt {
92
91
  const filled_context = filler.fill(action.context, requestVariables);
93
92
 
94
93
  if (action.history) {
95
- this.logger.info("[AI Prompt] using chat transcript");
94
+ this.logger.native("[AI Prompt] using chat transcript");
96
95
  let transcript_string = await TiledeskChatbot.getParameterStatic(
97
96
  this.context.tdcache,
98
97
  this.context.requestId,
@@ -212,7 +211,7 @@ class DirAiPrompt {
212
211
 
213
212
  winston.debug("DirAiPrompt resbody: ", resbody);
214
213
  answer = resbody.answer;
215
- this.logger.info("[AI Prompt] answer: ", answer);
214
+ this.logger.native("[AI Prompt] answer: ", answer);
216
215
 
217
216
  await this.#assignAttributes(action, answer);
218
217
 
@@ -300,7 +299,7 @@ class DirAiPrompt {
300
299
  }
301
300
  if (result === true) {
302
301
  if (trueIntentDirective) {
303
- this.logger.info("[AI Prompt] executing true condition");
302
+ this.logger.native("[AI Prompt] executing true condition");
304
303
  this.intentDir.execute(trueIntentDirective, () => {
305
304
  if (callback) {
306
305
  callback();
@@ -308,7 +307,7 @@ class DirAiPrompt {
308
307
  })
309
308
  }
310
309
  else {
311
- this.logger.info("[AI Prompt] no block connected to true condition");
310
+ this.logger.native("[AI Prompt] no block connected to true condition");
312
311
  winston.debug("DirAiPrompt No trueIntentDirective specified");
313
312
  if (callback) {
314
313
  callback();
@@ -317,7 +316,7 @@ class DirAiPrompt {
317
316
  }
318
317
  else {
319
318
  if (falseIntentDirective) {
320
- this.logger.info("[AI Prompt] executing false condition");
319
+ this.logger.native("[AI Prompt] executing false condition");
321
320
  this.intentDir.execute(falseIntentDirective, () => {
322
321
  if (callback) {
323
322
  callback();
@@ -325,7 +324,7 @@ class DirAiPrompt {
325
324
  });
326
325
  }
327
326
  else {
328
- this.logger.info("[AI Prompt] no block connected to false condition");
327
+ this.logger.native("[AI Prompt] no block connected to false condition");
329
328
  winston.debug("DirAiPrompt No falseIntentDirective specified");
330
329
  if (callback) {
331
330
  callback();
@@ -31,7 +31,6 @@ class DirAskGPTV2 {
31
31
  }
32
32
 
33
33
  execute(directive, callback) {
34
- this.logger.info("[Ask Knowledge Base] Executing action");
35
34
  winston.debug("DirAskGPTV2 directive: ", directive);
36
35
  let action;
37
36
  if (directive.action) {
@@ -44,7 +43,7 @@ class DirAskGPTV2 {
44
43
  return;
45
44
  }
46
45
  this.go(action, (stop) => {
47
- this.logger.info("[Ask Knowledge Base] Action completed");
46
+ this.logger.native("[Ask Knowledge Base] Executed");
48
47
  callback(stop);
49
48
  })
50
49
  }
@@ -139,7 +138,7 @@ class DirAskGPTV2 {
139
138
  const filled_context = filler.fill(action.context, requestVariables)
140
139
 
141
140
  if (action.history) {
142
- this.logger.info("[Ask Knowledge Base] use chat transcript")
141
+ this.logger.native("[Ask Knowledge Base] use chat transcript")
143
142
  let transcript_string = await TiledeskChatbot.getParameterStatic(
144
143
  this.context.tdcache,
145
144
  this.context.requestId,
@@ -161,7 +160,7 @@ class DirAskGPTV2 {
161
160
 
162
161
  let key = await integrationService.getKeyFromIntegrations(this.projectId, 'openai', this.token);
163
162
  if (!key) {
164
- this.logger.debug("[Ask Knowledge Base] OpenAI key not found in Integration. Using shared OpenAI key");
163
+ this.logger.native("[Ask Knowledge Base] OpenAI key not found in Integration. Using shared OpenAI key");
165
164
  winston.verbose("DirAskGPTV2 - Key not found in Integrations. Searching in kb settings...");
166
165
  key = await this.getKeyFromKbSettings();
167
166
  }
@@ -171,7 +170,7 @@ class DirAskGPTV2 {
171
170
  key = process.env.GPTKEY;
172
171
  publicKey = true;
173
172
  } else {
174
- this.logger.debug("[Ask Knowledge Base] use your own OpenAI key")
173
+ this.logger.native("[Ask Knowledge Base] use your own OpenAI key")
175
174
  }
176
175
 
177
176
  if (!key) {
@@ -203,12 +202,12 @@ class DirAskGPTV2 {
203
202
  if (action.namespaceAsName) {
204
203
  // Namespace could be an attribute
205
204
  const filled_namespace = filler.fill(action.namespace, requestVariables)
206
- this.logger.debug("[Ask Knowledge Base] Searching namespace by name ", filled_namespace);
205
+ this.logger.native("[Ask Knowledge Base] Searching namespace by name ", filled_namespace);
207
206
  ns = await this.getNamespace(filled_namespace, null);
208
207
  namespace = ns?.id;
209
208
  winston.verbose("DirAskGPTV2 - Retrieved namespace id from name " + namespace);
210
209
  } else {
211
- this.logger.debug("[Ask Knowledge Base] Searching namespace by id ", namespace);
210
+ this.logger.native("[Ask Knowledge Base] Searching namespace by id ", namespace);
212
211
  ns = await this.getNamespace(null, namespace);
213
212
  }
214
213
 
@@ -25,7 +25,6 @@ class DirAssistant {
25
25
  }
26
26
 
27
27
  execute(directive, callback) {
28
- this.logger.info("[ChatGPT Assistant] Executing action");
29
28
  winston.verbose("Execute Assistant directive");
30
29
  let action;
31
30
  if (directive.action) {
@@ -38,7 +37,7 @@ class DirAssistant {
38
37
  return;
39
38
  }
40
39
  this.go(action, (stop) => {
41
- this.logger.info("[ChatGPT Assistant] Action completed");
40
+ this.logger.native("[ChatGPT Assistant] Executed");
42
41
  callback(stop);
43
42
  });
44
43
  }
@@ -26,7 +26,6 @@ class DirBrevo {
26
26
  }
27
27
 
28
28
  execute(directive, callback) {
29
- this.logger.info("[Brevo] Executing action");
30
29
  winston.verbose("Execute DirBrevo directive");
31
30
  let action;
32
31
  if (directive.action) {
@@ -39,7 +38,7 @@ class DirBrevo {
39
38
  return;
40
39
  }
41
40
  this.go(action, (stop) => {
42
- this.logger.info("[Brevo] Action completed");
41
+ this.logger.native("[Brevo] Executed");
43
42
  callback(stop);
44
43
  })
45
44
  }
@@ -22,7 +22,6 @@ class DirCaptureUserReply {
22
22
  }
23
23
 
24
24
  execute(directive, callback) {
25
- this.logger.info("[Capture User Reply] Executing action");
26
25
  winston.verbose("Execute CaptureUserReply directive");
27
26
  let action;
28
27
  if (directive.action) {
@@ -48,7 +47,7 @@ class DirCaptureUserReply {
48
47
  const actionId = action["_tdActionId"];;
49
48
  await this.chatbot.lockIntent(this.requestId, intent_name);
50
49
  await this.chatbot.lockAction(this.requestId, actionId);
51
- this.logger.info("[Capture User Reply] Waiting for user reply...");
50
+ this.logger.native("[Capture User Reply] Waiting for user reply...");
52
51
  callback();
53
52
  return;
54
53
  } else {
@@ -63,7 +62,7 @@ class DirCaptureUserReply {
63
62
  }
64
63
  try {
65
64
  const user_reply = this.message.text;
66
- this.logger.info("[Capture User Reply] User replied with: ", user_reply);
65
+ this.logger.native("[Capture User Reply] User replied with: ", user_reply);
67
66
  if (this.context.tdcache) {
68
67
  if (action.assignResultTo) {
69
68
  winston.debug("(DirCaptureUserReply) assign assignResultTo: " + action.assignResultTo);
@@ -74,12 +73,12 @@ class DirCaptureUserReply {
74
73
  if (callback) {
75
74
  if (goToIntent) {
76
75
  this.#executeGoTo(goToIntent, () => {
77
- this.logger.info("[Capture User Reply] Action completed");
76
+ this.logger.native("[Capture User Reply] Executed");
78
77
  callback(); // continue the flow
79
78
  });
80
79
  }
81
80
  else {
82
- this.logger.info("[Capture User Reply] Action completed");
81
+ this.logger.native("[Capture User Reply] Executed");
83
82
  callback(); // continue the flow
84
83
  }
85
84
 
@@ -15,9 +15,8 @@ class DirClearTranscript {
15
15
  }
16
16
 
17
17
  execute(directive, callback) {
18
- this.logger.info("[Clear Transcript] Executing action");
19
18
  TiledeskChatbotUtil.clearConversationTranscript(this.context.chatbot, () => {
20
- this.logger.info("[Clear Transcript] Action completed");
19
+ this.logger.native("[Clear Transcript] Executed");
21
20
  callback();
22
21
  });
23
22
  }
@@ -20,7 +20,6 @@ class DirClose {
20
20
  }
21
21
 
22
22
  execute(directive, callback) {
23
- this.logger.info("[Close] Executing action");
24
23
  winston.verbose("Execute Close directive");
25
24
  this.tdClient.closeRequest(this.requestId, async (err) => {
26
25
  if (err) {
@@ -28,10 +27,10 @@ class DirClose {
28
27
  winston.error("(DirClose) Error: ", err);
29
28
  }
30
29
  else {
31
- this.logger.info("[Close] Request closed");
30
+ this.logger.native("[Close] Request closed");
32
31
  await this.chatbot.deleteParameter(TiledeskChatbotConst.USER_INPUT);
33
32
  }
34
- this.logger.info("[Close] Action completed");
33
+ this.logger.native("[Close] Executed");
35
34
  callback();
36
35
  });
37
36
  }