@tiledesk/tiledesk-tybot-connector 0.4.2 → 0.5.0-rc2

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 (87) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/ExtApi.js +3 -13
  3. package/ExtUtil.js +0 -1
  4. package/Logger.js +86 -0
  5. package/TdCache.js +5 -3
  6. package/TiledeskClientTest.js +5 -28
  7. package/TiledeskExpression.js +6 -47
  8. package/index.js +87 -273
  9. package/logs/app.log +12983 -275
  10. package/logs/app1.log +62258 -0
  11. package/logs/app2.log +46280 -0
  12. package/logs/app3.log +28864 -0
  13. package/models/IntentForm.js +30 -44
  14. package/models/IntentsMachineFactory.js +4 -3
  15. package/models/MockBotsDataSource.js +1 -17
  16. package/models/MockTdCache.js +0 -9
  17. package/models/MongodbBotsDataSource.js +29 -53
  18. package/models/MongodbIntentsMachine.js +5 -4
  19. package/models/TiledeskChatbot.js +79 -258
  20. package/models/TiledeskChatbotConst.js +9 -0
  21. package/models/TiledeskChatbotUtil.js +180 -232
  22. package/models/TiledeskIntentsMachine.js +5 -14
  23. package/models/faqKbService.js +0 -1
  24. package/package.json +5 -2
  25. package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +66 -139
  26. package/tiledeskChatbotPlugs/FillParamsChatbotPlug.js +7 -13
  27. package/tiledeskChatbotPlugs/Filler.js +0 -1
  28. package/tiledeskChatbotPlugs/MarkbotChatbotPlug.js +12 -20
  29. package/tiledeskChatbotPlugs/MessagePipeline.js +5 -15
  30. package/tiledeskChatbotPlugs/SplitsChatbotPlug.js +4 -13
  31. package/tiledeskChatbotPlugs/WebhookChatbotPlug.js +21 -89
  32. package/tiledeskChatbotPlugs/directives/DirAddTags.js +15 -98
  33. package/tiledeskChatbotPlugs/directives/DirAiPrompt.js +3 -3
  34. package/tiledeskChatbotPlugs/directives/DirAskGPT.js +32 -57
  35. package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +46 -70
  36. package/tiledeskChatbotPlugs/directives/DirAssign.js +11 -22
  37. package/tiledeskChatbotPlugs/directives/DirAssignFromFunction.js +15 -11
  38. package/tiledeskChatbotPlugs/directives/DirAssistant.js +48 -97
  39. package/tiledeskChatbotPlugs/directives/DirBrevo.js +37 -68
  40. package/tiledeskChatbotPlugs/directives/DirCaptureUserReply.js +8 -18
  41. package/tiledeskChatbotPlugs/directives/DirClose.js +3 -1
  42. package/tiledeskChatbotPlugs/directives/DirCode.js +15 -22
  43. package/tiledeskChatbotPlugs/directives/DirCondition.js +18 -24
  44. package/tiledeskChatbotPlugs/directives/DirConnectBlock.js +9 -13
  45. package/tiledeskChatbotPlugs/directives/DirContactUpdate.js +7 -19
  46. package/tiledeskChatbotPlugs/directives/DirCustomerio.js +30 -57
  47. package/tiledeskChatbotPlugs/directives/DirDeflectToHelpCenter.js +15 -20
  48. package/tiledeskChatbotPlugs/directives/DirDeleteVariable.js +7 -7
  49. package/tiledeskChatbotPlugs/directives/DirDepartment.js +13 -12
  50. package/tiledeskChatbotPlugs/directives/DirDisableInputText.js +2 -6
  51. package/tiledeskChatbotPlugs/directives/DirFireTiledeskEvent.js +4 -4
  52. package/tiledeskChatbotPlugs/directives/DirForm.js +15 -22
  53. package/tiledeskChatbotPlugs/directives/DirGptTask.js +38 -65
  54. package/tiledeskChatbotPlugs/directives/DirHubspot.js +27 -58
  55. package/tiledeskChatbotPlugs/directives/DirIfOnlineAgents.js +19 -26
  56. package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +22 -40
  57. package/tiledeskChatbotPlugs/directives/DirIfOpenHours.js +17 -32
  58. package/tiledeskChatbotPlugs/directives/DirIntent.js +16 -33
  59. package/tiledeskChatbotPlugs/directives/DirJSONCondition.js +14 -13
  60. package/tiledeskChatbotPlugs/directives/DirLockIntent.js +7 -12
  61. package/tiledeskChatbotPlugs/directives/DirMake.js +20 -52
  62. package/tiledeskChatbotPlugs/directives/DirMessage.js +35 -28
  63. package/tiledeskChatbotPlugs/directives/DirMessageToBot.js +10 -20
  64. package/tiledeskChatbotPlugs/directives/DirMoveToAgent.js +4 -2
  65. package/tiledeskChatbotPlugs/directives/DirMoveToUnassigned.js +4 -2
  66. package/tiledeskChatbotPlugs/directives/DirQapla.js +21 -50
  67. package/tiledeskChatbotPlugs/directives/DirRandomReply.js +9 -17
  68. package/tiledeskChatbotPlugs/directives/DirRemoveCurrentBot.js +4 -0
  69. package/tiledeskChatbotPlugs/directives/DirReplaceBot.js +4 -1
  70. package/tiledeskChatbotPlugs/directives/DirReplaceBotV2.js +10 -21
  71. package/tiledeskChatbotPlugs/directives/DirReplaceBotV3.js +9 -19
  72. package/tiledeskChatbotPlugs/directives/DirReply.js +32 -35
  73. package/tiledeskChatbotPlugs/directives/DirReplyV2.js +27 -69
  74. package/tiledeskChatbotPlugs/directives/DirSendEmail.js +8 -9
  75. package/tiledeskChatbotPlugs/directives/DirSendWhatsapp.js +13 -12
  76. package/tiledeskChatbotPlugs/directives/DirSetAttribute.js +7 -4
  77. package/tiledeskChatbotPlugs/directives/DirSetAttributeV2.js +22 -75
  78. package/tiledeskChatbotPlugs/directives/DirSetConversationTags.js +14 -13
  79. package/tiledeskChatbotPlugs/directives/DirUnlockIntent.js +3 -3
  80. package/tiledeskChatbotPlugs/directives/DirWait.js +4 -5
  81. package/tiledeskChatbotPlugs/directives/DirWebRequest.js +13 -48
  82. package/tiledeskChatbotPlugs/directives/DirWebRequestV2.js +11 -76
  83. package/tiledeskChatbotPlugs/directives/DirWebResponse.js +34 -7
  84. package/tiledeskChatbotPlugs/directives/DirWhatsappByAttribute.js +11 -14
  85. package/tiledeskChatbotPlugs/directives/Directives.js +1 -3
  86. package/utils/winston.js +42 -0
  87. package/TdCache copy.js +0 -242
@@ -1,5 +1,6 @@
1
1
 
2
2
  let axios = require('axios');
3
+ const winston = require('../utils/winston');
3
4
 
4
5
  class TiledeskIntentsMachine {
5
6
 
@@ -21,9 +22,9 @@ class TiledeskIntentsMachine {
21
22
  */
22
23
  async decode(botId, text) {
23
24
  return new Promise( (resolve, reject) => {
24
- if (this.log) {console.log("NLP AI...");}
25
+ winston.verbose("(TiledeskIntentsMachine) NLP AI...");
25
26
  const url = `${this.API_ENDPOINT}/model/parse`;
26
- if (this.log) {console.log("AI URL", url);}
27
+ winston.verbose("(TiledeskIntentsMachine) AI URL " + url);
27
28
  const HTTPREQUEST = {
28
29
  url: url,
29
30
  headers: {
@@ -43,7 +44,7 @@ class TiledeskIntentsMachine {
43
44
  reject(err);
44
45
  }
45
46
  else {
46
- console.log("Tiledesk AI replied:", resbody)
47
+ winston.verbose("(TiledeskIntentsMachine) Tiledesk AI replied:", resbody)
47
48
  resolve(this.translateForTiledesk(resbody));
48
49
  }
49
50
  }, false
@@ -94,10 +95,6 @@ class TiledeskIntentsMachine {
94
95
  }
95
96
 
96
97
  myrequest(options, callback, log) {
97
- if (this.log) {
98
- console.log("API URL:", options.url);
99
- console.log("** Options:", JSON.stringify(options));
100
- }
101
98
  axios(
102
99
  {
103
100
  url: options.url,
@@ -107,11 +104,6 @@ class TiledeskIntentsMachine {
107
104
  headers: options.headers
108
105
  })
109
106
  .then((res) => {
110
- if (this.log) {
111
- console.log("Response for url:", options.url);
112
- console.log("Response headers:\n", JSON.stringify(res.headers));
113
- //console.log("******** Response for url:", res);
114
- }
115
107
  if (res && res.status == 200 && res.data) {
116
108
  if (callback) {
117
109
  callback(null, res.data);
@@ -123,8 +115,7 @@ class TiledeskIntentsMachine {
123
115
  }
124
116
  }
125
117
  })
126
- .catch( (error) => {
127
- console.error("(TiledeskIntentsMachine) Axios error: ", JSON.stringify(error));
118
+ .catch((error) => {
128
119
  if (callback) {
129
120
  callback(error, null, null);
130
121
  }
@@ -13,7 +13,6 @@ class FaqKbService {
13
13
  }
14
14
  var sortQuery = {};
15
15
  sortQuery["score"] = -1;
16
- // console.log("(Service) GET ALL FAQ_KBs");
17
16
  return new Promise((resolve, reject) => {
18
17
  // let query = {public: options.public, certified: options.certified};
19
18
  Faq_kb.find(query).sort(sortQuery).lean().exec( (err, bots) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "0.4.2",
3
+ "version": "0.5.0-rc2",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,7 +15,9 @@
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.2.1-rc2",
18
19
  "accept-language-parser": "^1.5.0",
20
+ "app-root-path": "^3.1.0",
19
21
  "axios": "^1.7.7",
20
22
  "body-parser": "^1.19.0",
21
23
  "cors": "^2.8.5",
@@ -31,7 +33,8 @@
31
33
  "nanoid": "^3.1.25",
32
34
  "redis": "^4.7.0",
33
35
  "uuid": "^3.3.3",
34
- "vm2": "^3.9.13"
36
+ "vm2": "^3.9.13",
37
+ "winston": "^3.17.0"
35
38
  },
36
39
  "devDependencies": {
37
40
  "mocha": "^8.4.0"