@tiledesk/tiledesk-tybot-connector 0.1.52 → 0.1.53
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 +6 -1
- package/models/MongodbBotsDataSource.js +2 -1
- package/models/MongodbIntentsMachine.js +2 -1
- package/models/TiledeskChatbot.js +4 -1
- package/package.json +1 -1
- package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirCondition.js +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,12 +5,17 @@
|
|
|
5
5
|
available on:
|
|
6
6
|
▶️ https://www.npmjs.com/package/@tiledesk/tiledesk-tybot-connector
|
|
7
7
|
|
|
8
|
+
### 0.1.53
|
|
9
|
+
- removed projectId from query MongodbBotsDataSource.getByExactMatch()
|
|
10
|
+
- removed projectId from query MongodbIntentsMachine.decode()
|
|
11
|
+
- added on DirCondition the stopOnConditionMet option
|
|
12
|
+
|
|
8
13
|
### 0.1.52
|
|
9
14
|
- added tdChatbotName to request variables
|
|
10
15
|
- removed _ from _td prefix in tiledeskVariables (i.e. _tdDepartmentId => tdDepartmentId)
|
|
11
16
|
- added tdcache.hget()
|
|
12
17
|
- fixed bug on DirAgentHandoff. this.dirId missed on intent-to-intent crashed the application. Getting tdDepartmentId from Redis
|
|
13
|
-
- removed projectId from query getByIntentDisplayName(
|
|
18
|
+
- removed projectId from query MongodbBotsDataSource.getByIntentDisplayName()
|
|
14
19
|
|
|
15
20
|
### 0.1.51
|
|
16
21
|
- only debug on pre
|
|
@@ -26,7 +26,8 @@ class MongodbBotsDataSource {
|
|
|
26
26
|
async getByExactMatch(botId, text) {
|
|
27
27
|
// SEARCH INTENTS
|
|
28
28
|
return new Promise( (resolve, reject) => {
|
|
29
|
-
let query = { "id_project": this.projectId, "id_faq_kb": botId, "question": text };
|
|
29
|
+
// let query = { "id_project": this.projectId, "id_faq_kb": botId, "question": text };
|
|
30
|
+
let query = { "id_faq_kb": botId, "question": text };
|
|
30
31
|
Faq.find(query).lean().exec(async (err, faqs) => {
|
|
31
32
|
if (err) {
|
|
32
33
|
console.error("Error getting faq object.", err);
|
|
@@ -20,7 +20,8 @@ class MongodbIntentsMachine {
|
|
|
20
20
|
async decode(botId, text) {
|
|
21
21
|
return new Promise( (resolve, reject) => {
|
|
22
22
|
if (this.log) {console.log("Mongodb NLP decode intent...");}
|
|
23
|
-
let query = { "id_project": this.projectId, "id_faq_kb": botId };
|
|
23
|
+
// let query = { "id_project": this.projectId, "id_faq_kb": botId };
|
|
24
|
+
let query = { "id_faq_kb": botId };
|
|
24
25
|
var mongoproject = undefined;
|
|
25
26
|
var sort = undefined;
|
|
26
27
|
var search_obj = { "$search": text };
|
|
@@ -233,6 +233,9 @@ class TiledeskChatbot {
|
|
|
233
233
|
else {
|
|
234
234
|
// fallback
|
|
235
235
|
let fallbackIntent = await this.botsDataSource.getByIntentDisplayName(this.botId, "defaultFallback");
|
|
236
|
+
// console.log("In mongodb botId:", this.botId);
|
|
237
|
+
// console.log("getByIntentDisplayName(this.botId, 'defaultFallback'):", this.botId, "defaultFallback");
|
|
238
|
+
// console.log("fallbackIntent found!", JSON.stringify(fallbackIntent));
|
|
236
239
|
if (!fallbackIntent) {
|
|
237
240
|
console.log("No defaultFallback found!");
|
|
238
241
|
resolve(null);
|
|
@@ -541,7 +544,7 @@ class TiledeskChatbot {
|
|
|
541
544
|
return await _tdcache.hget(
|
|
542
545
|
TiledeskChatbot.requestCacheKey(requestId) + ":parameters", key);
|
|
543
546
|
}
|
|
544
|
-
|
|
547
|
+
|
|
545
548
|
static async deleteParameterStatic(_tdcache, requestId, paramName) {
|
|
546
549
|
return await _tdcache.hdel(
|
|
547
550
|
TiledeskChatbot.requestCacheKey(requestId) + ":parameters", paramName);
|
package/package.json
CHANGED
|
@@ -250,6 +250,7 @@ class DirectivesChatbotPlug {
|
|
|
250
250
|
else if (directive_name === Directives.CONDITION) {
|
|
251
251
|
// console.log("...DirCondition");
|
|
252
252
|
new DirCondition(context).execute(directive, async (stop) => {
|
|
253
|
+
console.log("stop on condition?", stop);
|
|
253
254
|
if (stop == true) {
|
|
254
255
|
if (context.log) { console.log("Stopping Actions on:", directive);}
|
|
255
256
|
this.theend();
|
|
@@ -62,8 +62,8 @@ class DirCondition {
|
|
|
62
62
|
callback();
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
this.go(action, () => {
|
|
66
|
-
callback();
|
|
65
|
+
this.go(action, (stop) => {
|
|
66
|
+
callback(stop);
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
}
|
|
@@ -76,7 +76,6 @@ class DirCondition {
|
|
|
76
76
|
let trueIntent = action.trueIntent;
|
|
77
77
|
let falseIntent = action.falseIntent;
|
|
78
78
|
let stopOnConditionMet = action.stopOnConditionMet;
|
|
79
|
-
console.log("executing action:", action);
|
|
80
79
|
if (trueIntent && trueIntent.trim() === "") {
|
|
81
80
|
trueIntent = null;
|
|
82
81
|
}
|
|
@@ -133,7 +132,8 @@ class DirCondition {
|
|
|
133
132
|
if (result === true) {
|
|
134
133
|
if (trueIntentDirective) {
|
|
135
134
|
this.intentDir.execute(trueIntentDirective, () => {
|
|
136
|
-
|
|
135
|
+
console.log("result === true. stopOnConditionMet?", stopOnConditionMet);
|
|
136
|
+
callback(true);
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
else {
|
|
@@ -145,6 +145,7 @@ class DirCondition {
|
|
|
145
145
|
else {
|
|
146
146
|
if (falseIntentDirective) {
|
|
147
147
|
this.intentDir.execute(falseIntentDirective, () => {
|
|
148
|
+
console.log("result === false. stopOnConditionMet?", stopOnConditionMet);
|
|
148
149
|
callback(stopOnConditionMet);
|
|
149
150
|
});
|
|
150
151
|
}
|