@tiledesk/tiledesk-tybot-connector 0.2.57-rc1 → 0.2.57-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
CHANGED
|
@@ -9,6 +9,8 @@ available on:
|
|
|
9
9
|
- Changed env variables for AskGPT actions
|
|
10
10
|
- Added support for temperature, top_k, max_tokens and context for AskGPTV2 action
|
|
11
11
|
- Added support for context with variables for GptTask action
|
|
12
|
+
- fixed catching reply error in index.js: reply = await chatbot.replyToMessage(message);
|
|
13
|
+
- Added support for DTMF and Blind Transfer (Reply for voice channel)
|
|
12
14
|
|
|
13
15
|
# v0.2.56
|
|
14
16
|
- Fixing Customerio Action not passing testing
|
package/index.js
CHANGED
|
@@ -174,7 +174,13 @@ router.post('/ext/:botid', async (req, res) => {
|
|
|
174
174
|
await TiledeskChatbotUtil.updateRequestAttributes(chatbot, message, projectId, requestId);
|
|
175
175
|
await TiledeskChatbotUtil.updateConversationTranscript(chatbot, message);
|
|
176
176
|
|
|
177
|
-
let reply =
|
|
177
|
+
let reply = null;
|
|
178
|
+
try {
|
|
179
|
+
reply = await chatbot.replyToMessage(message);
|
|
180
|
+
}
|
|
181
|
+
catch(err) {
|
|
182
|
+
console.error("An error occurred replying to message:", JSON.stringify(message), "\nError:", err );
|
|
183
|
+
}
|
|
178
184
|
if (!reply) {
|
|
179
185
|
reply = {
|
|
180
186
|
"text": "No messages found. Is 'defaultFallback' intent missing?"
|
|
@@ -336,20 +336,34 @@ class TiledeskChatbotUtil {
|
|
|
336
336
|
|
|
337
337
|
static async updateConversationTranscript(chatbot, message) {
|
|
338
338
|
// console.log("transcript updating with:", message)
|
|
339
|
+
|
|
340
|
+
console.log("chatbot name is:", chatbot.bot.name);
|
|
341
|
+
const chatbot_name = chatbot.bot.name.trim();
|
|
342
|
+
console.log("chatbot name is:", chatbot_name);
|
|
343
|
+
|
|
339
344
|
if (message && message.text && message.text.trim() !== "" && message.sender !== "_tdinternal" && !this.isHiddenMessage(message)) {
|
|
340
345
|
let transcript = await chatbot.getParameter("transcript");
|
|
341
346
|
// console.log("transcript got:", transcript);
|
|
347
|
+
const _name_of = name_of(message, chatbot_name);
|
|
342
348
|
if (transcript) {
|
|
343
|
-
transcript = transcript + "\n
|
|
349
|
+
transcript = transcript + "\n" + _name_of + message.text;
|
|
344
350
|
}
|
|
345
351
|
else {
|
|
346
|
-
transcript =
|
|
352
|
+
transcript = _name_of + message.text;
|
|
347
353
|
}
|
|
348
354
|
// console.log("transcript update:", transcript);
|
|
349
355
|
await chatbot.addParameter("transcript", transcript);
|
|
350
|
-
let transcript2 = await chatbot.getParameter("transcript");
|
|
356
|
+
// let transcript2 = await chatbot.getParameter("transcript");
|
|
351
357
|
// console.log("transcript updated:", transcript2);
|
|
352
358
|
}
|
|
359
|
+
|
|
360
|
+
function name_of(message, chatbot_name) {
|
|
361
|
+
let fullName = message.senderFullname;
|
|
362
|
+
if (fullName.trim() === chatbot_name) {
|
|
363
|
+
fullName = "bot:" + fullName;
|
|
364
|
+
}
|
|
365
|
+
return "[[[" + fullName + "]]]";
|
|
366
|
+
}
|
|
353
367
|
}
|
|
354
368
|
|
|
355
369
|
static isHiddenMessage(message) {
|
package/package.json
CHANGED
|
@@ -291,6 +291,20 @@ class DirectivesChatbotPlug {
|
|
|
291
291
|
this.process(next_dir);
|
|
292
292
|
});
|
|
293
293
|
}
|
|
294
|
+
else if (directive_name === Directives.DTMF_FORM) {
|
|
295
|
+
// console.log("...DirReply");
|
|
296
|
+
new DirReply(context).execute(directive, async () => {
|
|
297
|
+
let next_dir = await this.nextDirective(this.directives);
|
|
298
|
+
this.process(next_dir);
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
else if (directive_name === Directives.BLIND_TRANSFER) {
|
|
302
|
+
// console.log("...DirReply");
|
|
303
|
+
new DirReply(context).execute(directive, async () => {
|
|
304
|
+
let next_dir = await this.nextDirective(this.directives);
|
|
305
|
+
this.process(next_dir);
|
|
306
|
+
});
|
|
307
|
+
}
|
|
294
308
|
else if (directive_name === Directives.RANDOM_REPLY) {
|
|
295
309
|
// console.log("...DirRandomReply");
|
|
296
310
|
new DirRandomReply(context).execute(directive, async () => {
|
|
@@ -24,6 +24,8 @@ class Directives {
|
|
|
24
24
|
static SET_ATTRIBUTE = "setattribute";
|
|
25
25
|
static SET_ATTRIBUTE_V2 = "setattribute-v2";
|
|
26
26
|
static REPLY = 'reply';
|
|
27
|
+
static DTMF_FORM = 'dtmf_form';
|
|
28
|
+
static BLIND_TRANSFER = 'blind_transfer';
|
|
27
29
|
static RANDOM_REPLY = 'randomreply';
|
|
28
30
|
static CODE = 'code';
|
|
29
31
|
static WHATSAPP_ATTRIBUTE = 'whatsapp_attribute';
|