@tiledesk/tiledesk-tybot-connector 0.2.128 → 0.2.129
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 +10 -2
- package/TdCache.js +26 -8
- package/models/TiledeskChatbot.js +10 -7
- package/package.json +1 -1
- package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +13 -7
package/CHANGELOG.md
CHANGED
|
@@ -17,13 +17,21 @@ available on:
|
|
|
17
17
|
- Added flowError on JSONCondition when result = null
|
|
18
18
|
- Added fix on Filler -->
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# v0.2.129 -> test
|
|
23
|
+
- (TiledeskChatbot) sending as "info": "An error occurred while getting locked intent:'" + locked_intent + "'"
|
|
24
|
+
- (DirectivesChatbotPlug) added try catch on new TiledeskClient() => try {tdclient = new TiledeskClient({...})}
|
|
25
|
+
|
|
26
|
+
# v0.2.128 -> test
|
|
21
27
|
- Updated axios from 0.27.2 to 1.7.7
|
|
28
|
+
- fixes tdcache .set() with callback
|
|
29
|
+
|
|
22
30
|
# v0.2.127 -> test
|
|
23
31
|
- TiledeskChatbot =>
|
|
24
32
|
- static MAX_STEPS = 1000;
|
|
25
33
|
- static MAX_EXECUTION_TIME = 1000 * 3600 * 8;
|
|
26
|
-
|
|
34
|
+
|
|
27
35
|
# v0.2.126 -> test
|
|
28
36
|
- TdCache async del(key, callback) FIXED (await unsupported problem)
|
|
29
37
|
|
package/TdCache.js
CHANGED
|
@@ -47,10 +47,19 @@ class TdCache {
|
|
|
47
47
|
if (options && options.EX) {
|
|
48
48
|
//console.log("expires:", options.EX)
|
|
49
49
|
try {
|
|
50
|
-
|
|
50
|
+
this.client.set(
|
|
51
51
|
key,
|
|
52
52
|
value,
|
|
53
|
-
'EX', options.EX
|
|
53
|
+
'EX', options.EX,
|
|
54
|
+
(err) => {
|
|
55
|
+
if (err) {
|
|
56
|
+
reject(err);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return resolve();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
);
|
|
54
63
|
}
|
|
55
64
|
catch(error) {
|
|
56
65
|
reject(error)
|
|
@@ -61,18 +70,27 @@ class TdCache {
|
|
|
61
70
|
//console.log("setting here...key", key, value)
|
|
62
71
|
await this.client.set(
|
|
63
72
|
key,
|
|
64
|
-
value
|
|
73
|
+
value,
|
|
74
|
+
(err) => {
|
|
75
|
+
if (err) {
|
|
76
|
+
reject(err);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return resolve();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
);
|
|
65
83
|
}
|
|
66
84
|
catch(error) {
|
|
67
|
-
console.error("Error", error);
|
|
85
|
+
console.error("TdCache Error:", error);
|
|
68
86
|
reject(error)
|
|
69
87
|
}
|
|
70
88
|
}
|
|
71
|
-
if (options && options.callback) {
|
|
72
|
-
|
|
73
|
-
}
|
|
89
|
+
// if (options && options.callback) {
|
|
90
|
+
// options.callback();
|
|
91
|
+
// }
|
|
74
92
|
//console.log("resolving...", key);
|
|
75
|
-
return resolve();
|
|
93
|
+
// return resolve();
|
|
76
94
|
});
|
|
77
95
|
}
|
|
78
96
|
|
|
@@ -143,21 +143,24 @@ class TiledeskChatbot {
|
|
|
143
143
|
let reply;
|
|
144
144
|
if (faq) {
|
|
145
145
|
reply = await this.execIntent(faq, message, lead);//, bot);
|
|
146
|
-
resolve(reply);
|
|
147
|
-
return;
|
|
146
|
+
// resolve(reply);
|
|
147
|
+
// return;
|
|
148
148
|
}
|
|
149
149
|
else {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
reply = {
|
|
151
|
+
"text": "An error occurred while getting locked intent:'" + locked_intent + "'",
|
|
152
|
+
"attributes": {
|
|
153
|
+
"subtype": "info"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
153
156
|
// because of some race condition, during a mixed ReplyV2 Action button + Replace bot an
|
|
154
157
|
// intent can be found locked outside of the original chatbot scope.
|
|
155
158
|
// The temp solution is to immediatly unlock the intent and let the flow continue.
|
|
156
159
|
await this.unlockIntent(this.requestId);
|
|
157
160
|
await this.unlockAction(this.requestId);
|
|
158
161
|
}
|
|
159
|
-
|
|
160
|
-
|
|
162
|
+
resolve(reply);
|
|
163
|
+
return;
|
|
161
164
|
}
|
|
162
165
|
// }
|
|
163
166
|
// else if (message.text.startsWith("/")) {
|
package/package.json
CHANGED
|
@@ -136,13 +136,19 @@ class DirectivesChatbotPlug {
|
|
|
136
136
|
}
|
|
137
137
|
const projectId = supportRequest.id_project;
|
|
138
138
|
const tdcache = this.tdcache;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
139
|
+
let tdclient = null;
|
|
140
|
+
try {
|
|
141
|
+
tdclient = new TiledeskClient({
|
|
142
|
+
projectId: projectId,
|
|
143
|
+
token: token,
|
|
144
|
+
APIURL: API_URL,
|
|
145
|
+
APIKEY: "___",
|
|
146
|
+
log: this.log
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
catch(err) {
|
|
150
|
+
console.log("An error occurred while creating TiledeskClient in DirectivesChatbotPlug:", err);
|
|
151
|
+
}
|
|
146
152
|
|
|
147
153
|
this.context = {
|
|
148
154
|
projectId: projectId,
|