@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.
- package/CHANGELOG.md +28 -0
- package/ExtApi.js +3 -13
- package/ExtUtil.js +0 -1
- package/Logger.js +86 -0
- package/TdCache.js +5 -3
- package/TiledeskClientTest.js +5 -28
- package/TiledeskExpression.js +6 -47
- package/index.js +87 -273
- package/logs/app.log +12983 -275
- package/logs/app1.log +62258 -0
- package/logs/app2.log +46280 -0
- package/logs/app3.log +28864 -0
- package/models/IntentForm.js +30 -44
- package/models/IntentsMachineFactory.js +4 -3
- package/models/MockBotsDataSource.js +1 -17
- package/models/MockTdCache.js +0 -9
- package/models/MongodbBotsDataSource.js +29 -53
- package/models/MongodbIntentsMachine.js +5 -4
- package/models/TiledeskChatbot.js +79 -258
- package/models/TiledeskChatbotConst.js +9 -0
- package/models/TiledeskChatbotUtil.js +180 -232
- package/models/TiledeskIntentsMachine.js +5 -14
- package/models/faqKbService.js +0 -1
- package/package.json +5 -2
- package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +66 -139
- package/tiledeskChatbotPlugs/FillParamsChatbotPlug.js +7 -13
- package/tiledeskChatbotPlugs/Filler.js +0 -1
- package/tiledeskChatbotPlugs/MarkbotChatbotPlug.js +12 -20
- package/tiledeskChatbotPlugs/MessagePipeline.js +5 -15
- package/tiledeskChatbotPlugs/SplitsChatbotPlug.js +4 -13
- package/tiledeskChatbotPlugs/WebhookChatbotPlug.js +21 -89
- package/tiledeskChatbotPlugs/directives/DirAddTags.js +15 -98
- package/tiledeskChatbotPlugs/directives/DirAiPrompt.js +3 -3
- package/tiledeskChatbotPlugs/directives/DirAskGPT.js +32 -57
- package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +46 -70
- package/tiledeskChatbotPlugs/directives/DirAssign.js +11 -22
- package/tiledeskChatbotPlugs/directives/DirAssignFromFunction.js +15 -11
- package/tiledeskChatbotPlugs/directives/DirAssistant.js +48 -97
- package/tiledeskChatbotPlugs/directives/DirBrevo.js +37 -68
- package/tiledeskChatbotPlugs/directives/DirCaptureUserReply.js +8 -18
- package/tiledeskChatbotPlugs/directives/DirClose.js +3 -1
- package/tiledeskChatbotPlugs/directives/DirCode.js +15 -22
- package/tiledeskChatbotPlugs/directives/DirCondition.js +18 -24
- package/tiledeskChatbotPlugs/directives/DirConnectBlock.js +9 -13
- package/tiledeskChatbotPlugs/directives/DirContactUpdate.js +7 -19
- package/tiledeskChatbotPlugs/directives/DirCustomerio.js +30 -57
- package/tiledeskChatbotPlugs/directives/DirDeflectToHelpCenter.js +15 -20
- package/tiledeskChatbotPlugs/directives/DirDeleteVariable.js +7 -7
- package/tiledeskChatbotPlugs/directives/DirDepartment.js +13 -12
- package/tiledeskChatbotPlugs/directives/DirDisableInputText.js +2 -6
- package/tiledeskChatbotPlugs/directives/DirFireTiledeskEvent.js +4 -4
- package/tiledeskChatbotPlugs/directives/DirForm.js +15 -22
- package/tiledeskChatbotPlugs/directives/DirGptTask.js +38 -65
- package/tiledeskChatbotPlugs/directives/DirHubspot.js +27 -58
- package/tiledeskChatbotPlugs/directives/DirIfOnlineAgents.js +19 -26
- package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +22 -40
- package/tiledeskChatbotPlugs/directives/DirIfOpenHours.js +17 -32
- package/tiledeskChatbotPlugs/directives/DirIntent.js +16 -33
- package/tiledeskChatbotPlugs/directives/DirJSONCondition.js +14 -13
- package/tiledeskChatbotPlugs/directives/DirLockIntent.js +7 -12
- package/tiledeskChatbotPlugs/directives/DirMake.js +20 -52
- package/tiledeskChatbotPlugs/directives/DirMessage.js +35 -28
- package/tiledeskChatbotPlugs/directives/DirMessageToBot.js +10 -20
- package/tiledeskChatbotPlugs/directives/DirMoveToAgent.js +4 -2
- package/tiledeskChatbotPlugs/directives/DirMoveToUnassigned.js +4 -2
- package/tiledeskChatbotPlugs/directives/DirQapla.js +21 -50
- package/tiledeskChatbotPlugs/directives/DirRandomReply.js +9 -17
- package/tiledeskChatbotPlugs/directives/DirRemoveCurrentBot.js +4 -0
- package/tiledeskChatbotPlugs/directives/DirReplaceBot.js +4 -1
- package/tiledeskChatbotPlugs/directives/DirReplaceBotV2.js +10 -21
- package/tiledeskChatbotPlugs/directives/DirReplaceBotV3.js +9 -19
- package/tiledeskChatbotPlugs/directives/DirReply.js +32 -35
- package/tiledeskChatbotPlugs/directives/DirReplyV2.js +27 -69
- package/tiledeskChatbotPlugs/directives/DirSendEmail.js +8 -9
- package/tiledeskChatbotPlugs/directives/DirSendWhatsapp.js +13 -12
- package/tiledeskChatbotPlugs/directives/DirSetAttribute.js +7 -4
- package/tiledeskChatbotPlugs/directives/DirSetAttributeV2.js +22 -75
- package/tiledeskChatbotPlugs/directives/DirSetConversationTags.js +14 -13
- package/tiledeskChatbotPlugs/directives/DirUnlockIntent.js +3 -3
- package/tiledeskChatbotPlugs/directives/DirWait.js +4 -5
- package/tiledeskChatbotPlugs/directives/DirWebRequest.js +13 -48
- package/tiledeskChatbotPlugs/directives/DirWebRequestV2.js +11 -76
- package/tiledeskChatbotPlugs/directives/DirWebResponse.js +34 -7
- package/tiledeskChatbotPlugs/directives/DirWhatsappByAttribute.js +11 -14
- package/tiledeskChatbotPlugs/directives/Directives.js +1 -3
- package/utils/winston.js +42 -0
- 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
|
-
|
|
25
|
+
winston.verbose("(TiledeskIntentsMachine) NLP AI...");
|
|
25
26
|
const url = `${this.API_ENDPOINT}/model/parse`;
|
|
26
|
-
|
|
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
|
-
|
|
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(
|
|
127
|
-
console.error("(TiledeskIntentsMachine) Axios error: ", JSON.stringify(error));
|
|
118
|
+
.catch((error) => {
|
|
128
119
|
if (callback) {
|
|
129
120
|
callback(error, null, null);
|
|
130
121
|
}
|
package/models/faqKbService.js
CHANGED
|
@@ -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.
|
|
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"
|