@tiledesk/tiledesk-tybot-connector 2.0.29 → 2.0.30
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/ExtApi.js +0 -3
- package/engine/TiledeskChatbotConst.js +8 -1
- package/index.js +0 -9
- package/logs/app1.log +42823 -0
- package/logs/app2.log +13816 -0
- package/package.json +1 -1
- package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +13 -2
- package/tiledeskChatbotPlugs/directives/DirAiCondition.js +535 -0
- package/tiledeskChatbotPlugs/directives/DirAiPrompt.js +44 -1
- package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +4 -1
- package/tiledeskChatbotPlugs/directives/Directives.js +1 -0
- package/utils/TiledeskChatbotUtil.js +35 -0
package/ExtApi.js
CHANGED
|
@@ -32,7 +32,6 @@ class ExtApi {
|
|
|
32
32
|
* @param {string} token. User token
|
|
33
33
|
*/
|
|
34
34
|
sendSupportMessageExt(message, projectId, requestId, token, callback) {
|
|
35
|
-
const t4 = Date.now();
|
|
36
35
|
const jwt_token = this.fixToken(token);
|
|
37
36
|
const url = `${this.TILEBOT_ENDPOINT}/ext/${projectId}/requests/${requestId}/messages`;
|
|
38
37
|
winston.verbose("(ExtApi) sendSupportMessageExt URL" + url);
|
|
@@ -54,8 +53,6 @@ class ExtApi {
|
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
else {
|
|
57
|
-
const t4e = Date.now();
|
|
58
|
-
console.log(`[TIMER] sendSupportMessageExt in ${t4e - t4}ms ------ ${requestId}`);
|
|
59
56
|
if (callback) {
|
|
60
57
|
callback(null, resbody);
|
|
61
58
|
}
|
|
@@ -42,7 +42,14 @@ class TiledeskChatbotConst {
|
|
|
42
42
|
static REQ_LAST_USER_DOCUMENT_URL = 'lastUserDocumentURL';
|
|
43
43
|
static REQ_LAST_USER_DOCUMENT_NAME = 'lastUserDocumentName';
|
|
44
44
|
static REQ_LAST_USER_DOCUMENT_TYPE = 'lastUserDocumentType';
|
|
45
|
-
|
|
45
|
+
static REQ_EMAIL_ATTACHMENTS_LINK = 'link';
|
|
46
|
+
static REQ_EMAIL_SUBJECT = 'email_subject';
|
|
47
|
+
static REQ_EMAIL_TO = 'email_toEmail';
|
|
48
|
+
static REQ_EMAIL_FROM = 'email_fromEmail';
|
|
49
|
+
static REQ_EMAIL_MESSAGE_ID = 'email_messageId';
|
|
50
|
+
static REQ_EMAIL_REPLY_TO = 'email_replyTo';
|
|
51
|
+
static REQ_EMAIL_EML = 'email_eml';
|
|
52
|
+
static REQ_EMAIL_ATTACHMENTS_FILES = 'attachments'
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
module.exports = { TiledeskChatbotConst };
|
package/index.js
CHANGED
|
@@ -42,8 +42,6 @@ let TILEBOT_ENDPOINT = null;
|
|
|
42
42
|
let staticBots;
|
|
43
43
|
|
|
44
44
|
router.post('/ext/:botid', async (req, res) => {
|
|
45
|
-
const ttotal = Date.now()
|
|
46
|
-
const t1 = Date.now();
|
|
47
45
|
const botId = req.params.botid;
|
|
48
46
|
winston.verbose("(tybotRoute) POST /ext/:botid called: " + botId)
|
|
49
47
|
if(!botId || botId === "null" || botId === "undefined"){
|
|
@@ -172,12 +170,7 @@ router.post('/ext/:botid', async (req, res) => {
|
|
|
172
170
|
cache: tdcache
|
|
173
171
|
}
|
|
174
172
|
);
|
|
175
|
-
const t1e = Date.now();
|
|
176
|
-
console.log(`[TIMER] Preparation phase in ${t1e - t1}ms ------ ${requestId}`);
|
|
177
|
-
const t2 = Date.now();
|
|
178
173
|
directivesPlug.processDirectives( () => {
|
|
179
|
-
const t2e = Date.now();
|
|
180
|
-
console.log(`[TIMER] Directives executed in ${t2e - t2}ms ------ ${requestId}`);
|
|
181
174
|
winston.verbose("(tybotRoute) Actions - Directives executed.");
|
|
182
175
|
});
|
|
183
176
|
}
|
|
@@ -200,8 +193,6 @@ router.post('/ext/:botid', async (req, res) => {
|
|
|
200
193
|
TILEBOT_ENDPOINT: TILEBOT_ENDPOINT
|
|
201
194
|
});
|
|
202
195
|
apiext.sendSupportMessageExt(reply, projectId, requestId, token, () => {
|
|
203
|
-
const ttotale = Date.now()
|
|
204
|
-
console.log(`[TIMER] Directives executed in ${ttotal - ttotale}ms ------ ${requestId}`);
|
|
205
196
|
winston.verbose("(tybotRoute) sendSupportMessageExt reply sent: ", reply)
|
|
206
197
|
});
|
|
207
198
|
}
|