@tiledesk/tiledesk-tybot-connector 0.2.95-rc1 → 0.2.96-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.
- package/CHANGELOG.md +18 -2
- package/TiledeskExpression.js +1 -1
- package/package.json +1 -1
- package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +1 -1
- package/tiledeskChatbotPlugs/Filler.js +6 -0
- package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +49 -1
- package/tiledeskChatbotPlugs/directives/DirGptTask.js +6 -0
- package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +150 -203
- package/tiledeskChatbotPlugs/directives/DirJSONCondition.js +3 -0
- package/tiledeskChatbotPlugs/directives/DirWebRequestV2.js +3 -1
- package/tiledeskChatbotPlugs/directives/Directives.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,8 +5,21 @@
|
|
|
5
5
|
available on:
|
|
6
6
|
▶️ https://www.npmjs.com/package/@tiledesk/tiledesk-tybot-connector
|
|
7
7
|
|
|
8
|
-
# v0.2.
|
|
9
|
-
-
|
|
8
|
+
# v0.2.96-rc1
|
|
9
|
+
- Added support for response_format in GptTask
|
|
10
|
+
- Added namespaceAsName parameter in AskGPTv2
|
|
11
|
+
|
|
12
|
+
# v0.2.97
|
|
13
|
+
- Added a limit in upload and download for WebRequestV2: maxContentLength: 10000000, // max 10mb response size, maxBodyLength: 10000000 // max 10mb request body size
|
|
14
|
+
- Added jsonCondition test on json objects properties
|
|
15
|
+
- Added flowError on JSONCondition when result = null
|
|
16
|
+
- Added fix on Filler
|
|
17
|
+
|
|
18
|
+
# v0.2.96
|
|
19
|
+
- Added timestamp (number) and now (Date Object) attributes
|
|
20
|
+
|
|
21
|
+
# v0.2.95
|
|
22
|
+
- If Online Agents V2 - bug fix (If Project Available Agents V2 -> MWeb)
|
|
10
23
|
|
|
11
24
|
# v0.2.94
|
|
12
25
|
- Added support for chat history for AskGPTv2 action
|
|
@@ -149,6 +162,9 @@ available on:
|
|
|
149
162
|
- added flow attribute "decodedCustomJWT"
|
|
150
163
|
|
|
151
164
|
# v0.2.57
|
|
165
|
+
- Changed env variables for AskGPT actions
|
|
166
|
+
- Added support for temperature, top_k, max_tokens and context for AskGPTV2 action
|
|
167
|
+
- Added support for context with variables for GptTask action
|
|
152
168
|
- fixed catching reply error in index.js: reply = await chatbot.replyToMessage(message);
|
|
153
169
|
- Added context and top_k parameter in DirAskGPTV2
|
|
154
170
|
|
package/TiledeskExpression.js
CHANGED
|
@@ -359,7 +359,7 @@ class TiledeskExpression {
|
|
|
359
359
|
// console.log("operand1_s:", operand1_s);
|
|
360
360
|
}
|
|
361
361
|
else {
|
|
362
|
-
console.error("Condition evaluation stopped because of invalid
|
|
362
|
+
console.error("Condition evaluation stopped because of invalid operand1", condition.operand1);
|
|
363
363
|
return null;
|
|
364
364
|
}
|
|
365
365
|
|
package/package.json
CHANGED
|
@@ -312,7 +312,7 @@ class DirectivesChatbotPlug {
|
|
|
312
312
|
}
|
|
313
313
|
else if (directive_name === Directives.DTMF_MENU) {
|
|
314
314
|
// console.log("...DirReply");
|
|
315
|
-
new
|
|
315
|
+
new DirReply(context).execute(directive, async () => {
|
|
316
316
|
let next_dir = await this.nextDirective(this.directives);
|
|
317
317
|
this.process(next_dir);
|
|
318
318
|
});
|
|
@@ -4,6 +4,12 @@ var engine = new Liquid();
|
|
|
4
4
|
class Filler {
|
|
5
5
|
|
|
6
6
|
fill(text, parameters) {
|
|
7
|
+
// create dynamic attributes
|
|
8
|
+
if (parameters) {
|
|
9
|
+
parameters["timestamp"] = Date.now(); // type number
|
|
10
|
+
parameters["now"] = new Date(); // type Object
|
|
11
|
+
}
|
|
12
|
+
|
|
7
13
|
// legacy parser first
|
|
8
14
|
if (text == null || text == undefined || typeof text !== 'string') {
|
|
9
15
|
// console.log("Skip filling. 'text' is null or not a string");
|
|
@@ -171,6 +171,21 @@ class DirAskGPTV2 {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
|
|
174
|
+
if (action.namespaceAsName) {
|
|
175
|
+
namespace = await this.getNamespaceIdFromName(server_base_url, action.namespace)
|
|
176
|
+
if (this.log) { console.log("DirAskGPT - Retrieved namespace id from name ", namespace); }
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (!namespace) {
|
|
180
|
+
console.log("DirAskGPT - Error: namespace is undefined")
|
|
181
|
+
if (falseIntent) {
|
|
182
|
+
await this.chatbot.addParameter("flowError", "AskGPT Error: namespace is undefined");
|
|
183
|
+
await this.#executeCondition(false, trueIntent, trueIntentAttributes, falseIntent, falseIntentAttributes);
|
|
184
|
+
callback(true);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
174
189
|
let json = {
|
|
175
190
|
question: filled_question,
|
|
176
191
|
gptkey: key,
|
|
@@ -202,7 +217,7 @@ class DirAskGPTV2 {
|
|
|
202
217
|
}
|
|
203
218
|
|
|
204
219
|
if (this.log) { console.log("DirAskGPT json:", json); }
|
|
205
|
-
|
|
220
|
+
|
|
206
221
|
const HTTPREQUEST = {
|
|
207
222
|
// url: server_base_url + "/" + this.context.projectId + "/kb/qa",
|
|
208
223
|
url: kb_endpoint + "/qa",
|
|
@@ -546,6 +561,39 @@ class DirAskGPTV2 {
|
|
|
546
561
|
return objectTranscript;
|
|
547
562
|
}
|
|
548
563
|
|
|
564
|
+
async getNamespaceIdFromName(server_base_url, name) {
|
|
565
|
+
return new Promise((resolve) => {
|
|
566
|
+
|
|
567
|
+
const HTTPREQUEST = {
|
|
568
|
+
url: server_base_url + "/" + this.context.projectId + "/kb/namespace/all",
|
|
569
|
+
headers: {
|
|
570
|
+
'Content-Type': 'application/json',
|
|
571
|
+
'Authorization': 'JWT ' + this.context.token
|
|
572
|
+
},
|
|
573
|
+
method: "GET"
|
|
574
|
+
}
|
|
575
|
+
if (this.log) { console.log("DirAskGPT check quote availability HTTPREQUEST", HTTPREQUEST); }
|
|
576
|
+
|
|
577
|
+
this.#myrequest(
|
|
578
|
+
HTTPREQUEST, async (err, namespaces) => {
|
|
579
|
+
if (err) {
|
|
580
|
+
console.error("(httprequest) DirAskGPT get all namespaces err: ", err);
|
|
581
|
+
resolve(null)
|
|
582
|
+
} else {
|
|
583
|
+
if (this.log) { console.log("(httprequest) DirAskGPT Increment token quote resbody: ", namespaces); }
|
|
584
|
+
console.log("(httprequest) DirAskGPT Increment token quote resbody: ", namespaces);
|
|
585
|
+
|
|
586
|
+
let namespace = namespaces.find(n => n.name === name);
|
|
587
|
+
let namespace_id = namespace.id;
|
|
588
|
+
|
|
589
|
+
resolve(namespace_id);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
)
|
|
593
|
+
})
|
|
594
|
+
|
|
595
|
+
}
|
|
596
|
+
|
|
549
597
|
|
|
550
598
|
}
|
|
551
599
|
|
|
@@ -168,6 +168,12 @@ class DirGptTask {
|
|
|
168
168
|
json.messages.push(message);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
if (action.format_type) {
|
|
172
|
+
json.response_format = {
|
|
173
|
+
type: action.format_type
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
171
177
|
if (transcript) {
|
|
172
178
|
transcript.forEach(msg => {
|
|
173
179
|
if (!msg.content.startsWith('/')) {
|
|
@@ -74,25 +74,13 @@ class DirIfOnlineAgentsV2 {
|
|
|
74
74
|
|
|
75
75
|
let agents;
|
|
76
76
|
if (selectedOption === "currentDep") {
|
|
77
|
-
console.log("(DirIfOnlineAgents) currentDep");
|
|
78
|
-
// let departmentId;
|
|
77
|
+
if (this.log) {console.log("(DirIfOnlineAgents) currentDep"); }
|
|
79
78
|
let departmentId = await this.chatbot.getParameter("department_id");
|
|
80
|
-
console.log("this.context.departmentId:", departmentId);
|
|
81
|
-
|
|
82
|
-
// if (this.context.tdcache) {
|
|
83
|
-
// let attributes =
|
|
84
|
-
// await TiledeskChatbot.allParametersStatic(
|
|
85
|
-
// this.context.tdcache, this.context.requestId
|
|
86
|
-
// );
|
|
87
|
-
// if (this.log) {console.log("Attributes:::", JSON.stringify(attributes))}
|
|
88
|
-
// departmentId = attributes["department_id"];
|
|
89
|
-
// if (this.log) {console.log("Attributes.departmentId:::", departmentId)}
|
|
90
|
-
// }
|
|
79
|
+
if (this.log) {console.log("this.context.departmentId:", departmentId);}
|
|
91
80
|
|
|
92
81
|
if (departmentId) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
agents = await this.getDepartmentAvailableAgents(departmentId);
|
|
82
|
+
if (this.log) {console.log("(DirIfOnlineAgents) agents = await this.getProjectAvailableAgents(", departmentId, ", true);"); }
|
|
83
|
+
agents = await this.getProjectAvailableAgents(departmentId, true);
|
|
96
84
|
if (this.log) {console.log("(DirIfOnlineAgents) agents:", agents); }
|
|
97
85
|
} else {
|
|
98
86
|
console.error("(DirIfOnlineAgents) no departmentId found in attributes");
|
|
@@ -113,12 +101,14 @@ class DirIfOnlineAgentsV2 {
|
|
|
113
101
|
}
|
|
114
102
|
else if (selectedOption === "selectedDep") {
|
|
115
103
|
if (this.log) {console.log("(DirIfOnlineAgents) selectedOption === selectedDep", action.selectedDepartmentId); }
|
|
116
|
-
agents = await this.
|
|
104
|
+
if (this.log) {console.log("(DirIfOnlineAgents) agents = await this.getProjectAvailableAgents(", action.selectedDepartmentId, ", true);"); }
|
|
105
|
+
|
|
106
|
+
agents = await this.getProjectAvailableAgents(action.selectedDepartmentId, true);
|
|
117
107
|
if (this.log) {console.log("(DirIfOnlineAgents) agents:", agents); }
|
|
118
108
|
}
|
|
119
109
|
else { // if (checkAll) => go project-wide
|
|
120
|
-
if (this.log) {console.log("(DirIfOnlineAgents) selectedOption === all"); }
|
|
121
|
-
agents = await this.getProjectAvailableAgents(true);
|
|
110
|
+
if (this.log) {console.log("(DirIfOnlineAgents) selectedOption === all | getProjectAvailableAgents(null, true)"); }
|
|
111
|
+
agents = await this.getProjectAvailableAgents(null, true);
|
|
122
112
|
if (this.log) {console.log("(DirIfOnlineAgents) agents:", agents); }
|
|
123
113
|
}
|
|
124
114
|
|
|
@@ -152,8 +142,7 @@ class DirIfOnlineAgentsV2 {
|
|
|
152
142
|
} else {
|
|
153
143
|
if (falseIntent) {
|
|
154
144
|
let intentDirective = DirIntent.intentDirectiveFor(falseIntent, falseIntentAttributes);
|
|
155
|
-
if (this.log) {console.log("!agents (!openHours) => falseIntent");}
|
|
156
|
-
console.log("!agents (!openHours) => falseIntent BECAUSE CLOSED"); //PROD
|
|
145
|
+
if (this.log) { console.log("!agents (!openHours) => falseIntent"); }
|
|
157
146
|
this.intentDir.execute(intentDirective, () => {
|
|
158
147
|
callback();
|
|
159
148
|
});
|
|
@@ -184,9 +173,12 @@ class DirIfOnlineAgentsV2 {
|
|
|
184
173
|
});
|
|
185
174
|
}
|
|
186
175
|
|
|
187
|
-
async getProjectAvailableAgents(raw, callback) {
|
|
176
|
+
async getProjectAvailableAgents(departmentId, raw, callback) {
|
|
188
177
|
return new Promise( (resolve, reject) => {
|
|
189
|
-
|
|
178
|
+
let URL = `${this.context.TILEDESK_APIURL}/projects/${this.context.projectId}/users/availables?raw=${raw}`
|
|
179
|
+
if (departmentId) {
|
|
180
|
+
URL = URL + `&department=${departmentId}`
|
|
181
|
+
}
|
|
190
182
|
const HTTPREQUEST = {
|
|
191
183
|
url: URL,
|
|
192
184
|
headers: {
|
|
@@ -216,112 +208,99 @@ class DirIfOnlineAgentsV2 {
|
|
|
216
208
|
|
|
217
209
|
}
|
|
218
210
|
|
|
219
|
-
// async
|
|
211
|
+
// async getDepartmentAvailableAgents(depId) {
|
|
220
212
|
// return new Promise( (resolve, reject) => {
|
|
221
|
-
// this.tdclient.
|
|
222
|
-
// if (
|
|
223
|
-
// reject(
|
|
213
|
+
// this.tdclient.getDepartment(depId, async (error, dep) => {
|
|
214
|
+
// if (error) {
|
|
215
|
+
// reject(error);
|
|
224
216
|
// }
|
|
225
217
|
// else {
|
|
226
|
-
//
|
|
218
|
+
// if (this.log) {console.log("(DirIfOnlineAgents) got department:", JSON.stringify(dep)); }
|
|
219
|
+
// const groupId = dep.id_group;
|
|
220
|
+
// if (this.log) {console.log("(DirIfOnlineAgents) department.groupId:", groupId); }
|
|
221
|
+
// try {
|
|
222
|
+
// if (groupId) {
|
|
223
|
+
// const group = await this.getGroup(groupId);
|
|
224
|
+
// if (this.log) { console.log("(DirIfOnlineAgents) got group info:", group); }
|
|
225
|
+
// if (group) {
|
|
226
|
+
// if (group.members) {
|
|
227
|
+
// if (this.log) { console.log("(DirIfOnlineAgents) group members ids:", group.members);}
|
|
228
|
+
// // let group_members = await getTeammates(group.members);
|
|
229
|
+
// // console.log("group members details:", group_members);
|
|
230
|
+
// let all_teammates = await this.getAllTeammates();
|
|
231
|
+
// if (this.log) { console.log("(DirIfOnlineAgents) all teammates:", all_teammates); }
|
|
232
|
+
// if (all_teammates && all_teammates.length > 0){
|
|
233
|
+
// // [
|
|
234
|
+
// // {
|
|
235
|
+
// // "user_available": false,
|
|
236
|
+
// // ...
|
|
237
|
+
// // "id_user": {
|
|
238
|
+
// // "status": 100,
|
|
239
|
+
// // "email": "michele@tiledesk.com",
|
|
240
|
+
// // "firstname": "Michele",
|
|
241
|
+
// // "lastname": "Pomposo",
|
|
242
|
+
// // ...
|
|
243
|
+
// // },
|
|
244
|
+
// // "role": "admin",
|
|
245
|
+
// // "tags": [],
|
|
246
|
+
// // "presence": {
|
|
247
|
+
// // "status": "offline",
|
|
248
|
+
// // "changedAt": "2023-11-16T12:37:31.990Z"
|
|
249
|
+
// // },
|
|
250
|
+
// // "isBusy": false
|
|
251
|
+
// // }, ... ]
|
|
252
|
+
// // filter on availability
|
|
253
|
+
// console.log("(DirIfOnlineAgents) filtering available agents for group:", groupId);
|
|
254
|
+
// let available_agents = [];
|
|
255
|
+
// all_teammates.forEach((agent) => {
|
|
256
|
+
// if (this.log) { console.log("Checking teammate:", agent.id_user._id, "(", agent.id_user.email ,") Available:", agent.user_available, ") with members:",group.members ); }
|
|
257
|
+
// if (agent.user_available === true && group.members.includes(agent.id_user._id)) {
|
|
258
|
+
// console.log("Adding teammate:", agent.id_user._id);
|
|
259
|
+
// available_agents.push(agent);
|
|
260
|
+
// }
|
|
261
|
+
// });
|
|
262
|
+
// if (this.log) { console.log("(DirIfOnlineAgents) available agents in group:", available_agents); }
|
|
263
|
+
// resolve(available_agents);
|
|
264
|
+
// }
|
|
265
|
+
// }
|
|
266
|
+
// else {
|
|
267
|
+
// this.chatbot.addParameter("flowError", "(If online Agents) Empty group:" + groupId);
|
|
268
|
+
// resolve([]);
|
|
269
|
+
// }
|
|
270
|
+
// }
|
|
271
|
+
// else {
|
|
272
|
+
// this.chatbot.addParameter("flowError", "(If online Agents) Error: no group for groupId:" + groupId);
|
|
273
|
+
// resolve([]);
|
|
274
|
+
// }
|
|
275
|
+
// }
|
|
276
|
+
// else {
|
|
277
|
+
// // no group => assigned to all teammates
|
|
278
|
+
// const agents = await this.getProjectAvailableAgents(true);
|
|
279
|
+
// resolve(agents);
|
|
280
|
+
// }
|
|
281
|
+
// }
|
|
282
|
+
// catch(error) {
|
|
283
|
+
// console.error("(DirIfOnlineAgents) Error:", error);
|
|
284
|
+
// reject(error);
|
|
285
|
+
// }
|
|
227
286
|
// }
|
|
228
287
|
// });
|
|
229
|
-
// })
|
|
288
|
+
// });
|
|
230
289
|
// }
|
|
231
290
|
|
|
232
|
-
async getDepartmentAvailableAgents(depId) {
|
|
233
|
-
return new Promise( (resolve, reject) => {
|
|
234
|
-
this.tdclient.getDepartment(depId, async (error, dep) => {
|
|
235
|
-
if (error) {
|
|
236
|
-
reject(error);
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
if (this.log) {console.log("(DirIfOnlineAgents) got department:", JSON.stringify(dep)); }
|
|
240
|
-
const groupId = dep.id_group;
|
|
241
|
-
if (this.log) {console.log("(DirIfOnlineAgents) department.groupId:", groupId); }
|
|
242
|
-
try {
|
|
243
|
-
if (groupId) {
|
|
244
|
-
const group = await this.getGroup(groupId);
|
|
245
|
-
if (this.log) { console.log("(DirIfOnlineAgents) got group info:", group); }
|
|
246
|
-
if (group) {
|
|
247
|
-
if (group.members) {
|
|
248
|
-
if (this.log) { console.log("(DirIfOnlineAgents) group members ids:", group.members);}
|
|
249
|
-
// let group_members = await getTeammates(group.members);
|
|
250
|
-
// console.log("group members details:", group_members);
|
|
251
|
-
let all_teammates = await this.getAllTeammates();
|
|
252
|
-
if (this.log) { console.log("(DirIfOnlineAgents) all teammates:", all_teammates); }
|
|
253
|
-
if (all_teammates && all_teammates.length > 0){
|
|
254
|
-
// [
|
|
255
|
-
// {
|
|
256
|
-
// "user_available": false,
|
|
257
|
-
// ...
|
|
258
|
-
// "id_user": {
|
|
259
|
-
// "status": 100,
|
|
260
|
-
// "email": "michele@tiledesk.com",
|
|
261
|
-
// "firstname": "Michele",
|
|
262
|
-
// "lastname": "Pomposo",
|
|
263
|
-
// ...
|
|
264
|
-
// },
|
|
265
|
-
// "role": "admin",
|
|
266
|
-
// "tags": [],
|
|
267
|
-
// "presence": {
|
|
268
|
-
// "status": "offline",
|
|
269
|
-
// "changedAt": "2023-11-16T12:37:31.990Z"
|
|
270
|
-
// },
|
|
271
|
-
// "isBusy": false
|
|
272
|
-
// }, ... ]
|
|
273
|
-
// filter on availability
|
|
274
|
-
console.log("(DirIfOnlineAgents) filtering available agents for group:", groupId);
|
|
275
|
-
let available_agents = [];
|
|
276
|
-
all_teammates.forEach((agent) => {
|
|
277
|
-
if (this.log) { console.log("Checking teammate:", agent.id_user._id, "(", agent.id_user.email ,") Available:", agent.user_available, ") with members:",group.members ); }
|
|
278
|
-
if (agent.user_available === true && group.members.includes(agent.id_user._id)) {
|
|
279
|
-
console.log("Adding teammate:", agent.id_user._id);
|
|
280
|
-
available_agents.push(agent);
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
if (this.log) { console.log("(DirIfOnlineAgents) available agents in group:", available_agents); }
|
|
284
|
-
resolve(available_agents);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
else {
|
|
288
|
-
this.chatbot.addParameter("flowError", "(If online Agents) Empty group:" + groupId);
|
|
289
|
-
resolve([]);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
this.chatbot.addParameter("flowError", "(If online Agents) Error: no group for groupId:" + groupId);
|
|
294
|
-
resolve([]);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
else {
|
|
298
|
-
// no group => assigned to all teammates
|
|
299
|
-
const agents = await this.getProjectAvailableAgents(true);
|
|
300
|
-
resolve(agents);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
catch(error) {
|
|
304
|
-
console.error("(DirIfOnlineAgents) Error:", error);
|
|
305
|
-
reject(error);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
|
|
312
291
|
// async getGroup(groupId, callback) {
|
|
313
292
|
// return new Promise ( (resolve, reject) => {
|
|
314
|
-
// const URL = `${this.
|
|
293
|
+
// const URL = `${this.context.TILEDESK_APIURL}/${this.context.projectId}/groups/${groupId}`
|
|
315
294
|
// const HTTPREQUEST = {
|
|
316
295
|
// url: URL,
|
|
317
296
|
// headers: {
|
|
318
297
|
// 'Content-Type' : 'application/json',
|
|
319
|
-
// 'Authorization': this.context.token
|
|
298
|
+
// 'Authorization': this.fixToken(this.context.token)
|
|
320
299
|
// },
|
|
321
300
|
// method: 'GET',
|
|
322
301
|
// httpsOptions: this.httpsOptions
|
|
323
302
|
// };
|
|
324
|
-
//
|
|
303
|
+
// this.#myrequest(
|
|
325
304
|
// HTTPREQUEST,
|
|
326
305
|
// function(err, resbody) {
|
|
327
306
|
// if (err) {
|
|
@@ -331,6 +310,20 @@ class DirIfOnlineAgentsV2 {
|
|
|
331
310
|
// }
|
|
332
311
|
// }
|
|
333
312
|
// else {
|
|
313
|
+
// // {
|
|
314
|
+
// // "members": [
|
|
315
|
+
// // "62b317986993970035f0697e",
|
|
316
|
+
// // "5aaa99024c3b110014b478f0"
|
|
317
|
+
// // ],
|
|
318
|
+
// // "_id": "65ddec23fd8dc3003295cdd7",
|
|
319
|
+
// // "name": "Sales",
|
|
320
|
+
// // "trashed": false,
|
|
321
|
+
// // "id_project": "65203e12f8c0cf002cf4110b",
|
|
322
|
+
// // "createdBy": "5e09d16d4d36110017506d7f",
|
|
323
|
+
// // "createdAt": "2024-02-27T14:05:23.373Z",
|
|
324
|
+
// // "updatedAt": "2024-02-27T14:05:29.137Z",
|
|
325
|
+
// // "__v": 0
|
|
326
|
+
// // }
|
|
334
327
|
// resolve(resbody);
|
|
335
328
|
// if (callback) {
|
|
336
329
|
// callback(null, resbody);
|
|
@@ -341,97 +334,51 @@ class DirIfOnlineAgentsV2 {
|
|
|
341
334
|
// });
|
|
342
335
|
// }
|
|
343
336
|
|
|
344
|
-
async
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
async getAllTeammates(members, callback) {
|
|
391
|
-
return new Promise ( (resolve, reject) => {
|
|
392
|
-
const URL = `${this.context.TILEDESK_APIURL}/${this.context.projectId}/project_users`
|
|
393
|
-
const HTTPREQUEST = {
|
|
394
|
-
url: URL,
|
|
395
|
-
headers: {
|
|
396
|
-
'Content-Type' : 'application/json',
|
|
397
|
-
'Authorization': this.fixToken(this.context.token)
|
|
398
|
-
},
|
|
399
|
-
method: 'GET',
|
|
400
|
-
httpsOptions: this.httpsOptions
|
|
401
|
-
};
|
|
402
|
-
this.#myrequest(
|
|
403
|
-
HTTPREQUEST,
|
|
404
|
-
function(err, resbody) {
|
|
405
|
-
if (err) {
|
|
406
|
-
reject(err);
|
|
407
|
-
if (callback) {
|
|
408
|
-
callback(err);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
else {
|
|
412
|
-
// {
|
|
413
|
-
// "members": [
|
|
414
|
-
// "62b317986993970035f0697e",
|
|
415
|
-
// "5aaa99024c3b110014b478f0"
|
|
416
|
-
// ],
|
|
417
|
-
// "_id": "65ddec23fd8dc3003295cdd7",
|
|
418
|
-
// "name": "Sales",
|
|
419
|
-
// "trashed": false,
|
|
420
|
-
// "id_project": "65203e12f8c0cf002cf4110b",
|
|
421
|
-
// "createdBy": "5e09d16d4d36110017506d7f",
|
|
422
|
-
// "createdAt": "2024-02-27T14:05:23.373Z",
|
|
423
|
-
// "updatedAt": "2024-02-27T14:05:29.137Z",
|
|
424
|
-
// "__v": 0
|
|
425
|
-
// }
|
|
426
|
-
resolve(resbody);
|
|
427
|
-
if (callback) {
|
|
428
|
-
callback(null, resbody);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}, this.log
|
|
432
|
-
);
|
|
433
|
-
});
|
|
434
|
-
}
|
|
337
|
+
// async getAllTeammates(members, callback) {
|
|
338
|
+
// return new Promise ( (resolve, reject) => {
|
|
339
|
+
// const URL = `${this.context.TILEDESK_APIURL}/${this.context.projectId}/project_users`
|
|
340
|
+
// const HTTPREQUEST = {
|
|
341
|
+
// url: URL,
|
|
342
|
+
// headers: {
|
|
343
|
+
// 'Content-Type' : 'application/json',
|
|
344
|
+
// 'Authorization': this.fixToken(this.context.token)
|
|
345
|
+
// },
|
|
346
|
+
// method: 'GET',
|
|
347
|
+
// httpsOptions: this.httpsOptions
|
|
348
|
+
// };
|
|
349
|
+
// this.#myrequest(
|
|
350
|
+
// HTTPREQUEST,
|
|
351
|
+
// function(err, resbody) {
|
|
352
|
+
// if (err) {
|
|
353
|
+
// reject(err);
|
|
354
|
+
// if (callback) {
|
|
355
|
+
// callback(err);
|
|
356
|
+
// }
|
|
357
|
+
// }
|
|
358
|
+
// else {
|
|
359
|
+
// // {
|
|
360
|
+
// // "members": [
|
|
361
|
+
// // "62b317986993970035f0697e",
|
|
362
|
+
// // "5aaa99024c3b110014b478f0"
|
|
363
|
+
// // ],
|
|
364
|
+
// // "_id": "65ddec23fd8dc3003295cdd7",
|
|
365
|
+
// // "name": "Sales",
|
|
366
|
+
// // "trashed": false,
|
|
367
|
+
// // "id_project": "65203e12f8c0cf002cf4110b",
|
|
368
|
+
// // "createdBy": "5e09d16d4d36110017506d7f",
|
|
369
|
+
// // "createdAt": "2024-02-27T14:05:23.373Z",
|
|
370
|
+
// // "updatedAt": "2024-02-27T14:05:29.137Z",
|
|
371
|
+
// // "__v": 0
|
|
372
|
+
// // }
|
|
373
|
+
// resolve(resbody);
|
|
374
|
+
// if (callback) {
|
|
375
|
+
// callback(null, resbody);
|
|
376
|
+
// }
|
|
377
|
+
// }
|
|
378
|
+
// }, this.log
|
|
379
|
+
// );
|
|
380
|
+
// });
|
|
381
|
+
// }
|
|
435
382
|
|
|
436
383
|
#myrequest(options, callback) {
|
|
437
384
|
if (this.log) {
|
|
@@ -119,6 +119,9 @@ class DirJSONCondition {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
else {
|
|
122
|
+
if (result === null) {
|
|
123
|
+
await this.chatbot.addParameter("flowError", "An error occurred evaluating condition: result === null");
|
|
124
|
+
}
|
|
122
125
|
if (falseIntentDirective) {
|
|
123
126
|
this.intentDir.execute(falseIntentDirective, () => {
|
|
124
127
|
// console.log("result === false. stopOnConditionMet?", stopOnConditionMet);
|
|
@@ -273,7 +273,9 @@ class DirWebRequestV2 {
|
|
|
273
273
|
method: options.method,
|
|
274
274
|
params: options.params,
|
|
275
275
|
headers: options.headers,
|
|
276
|
-
timeout: options.timeout
|
|
276
|
+
timeout: options.timeout,
|
|
277
|
+
maxContentLength: 10000000, // max 10mb response size
|
|
278
|
+
maxBodyLength: 10000000 // max 10mb request body size
|
|
277
279
|
}
|
|
278
280
|
|
|
279
281
|
if (options.json !== null) {
|