botium-core 1.12.6 → 1.13.0
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/dist/botium-cjs.js +181 -108
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +181 -108
- package/dist/botium-es.js.map +1 -1
- package/package.json +22 -22
- package/src/Capabilities.js +7 -0
- package/src/scripting/CompilerCsv.js +150 -102
- package/src/scripting/ScriptingProvider.js +5 -1
- package/test/compiler/compilercsv.spec.js +363 -12
- package/test/compiler/convos/csv/utterances_liveperson.csv +108 -0
- package/test/compiler/convos/csv/utterances_multicolumn3col.csv +3 -0
- package/test/compiler/convos/csv/utterances_multicolumn5col.csv +3 -0
- package/test/compiler/convos/csv/utterances_singlecolumn.csv +3 -0
- package/test/compiler/convos/csv/utterances_variable_row_len.csv +3 -0
package/dist/botium-es.js
CHANGED
|
@@ -36,7 +36,7 @@ import express from 'express';
|
|
|
36
36
|
import bodyParser from 'body-parser';
|
|
37
37
|
|
|
38
38
|
var name = "botium-core";
|
|
39
|
-
var version$1 = "1.
|
|
39
|
+
var version$1 = "1.13.0";
|
|
40
40
|
var description = "The Selenium for Chatbots";
|
|
41
41
|
var main = "index.js";
|
|
42
42
|
var module = "dist/botium-es.js";
|
|
@@ -68,22 +68,22 @@ var bugs = {
|
|
|
68
68
|
};
|
|
69
69
|
var homepage = "https://www.botium.ai";
|
|
70
70
|
var dependencies = {
|
|
71
|
-
"@babel/runtime": "^7.
|
|
72
|
-
async: "^3.2.
|
|
71
|
+
"@babel/runtime": "^7.18.3",
|
|
72
|
+
async: "^3.2.4",
|
|
73
73
|
"body-parser": "^1.20.0",
|
|
74
74
|
boolean: "^3.2.0",
|
|
75
75
|
bottleneck: "^2.19.5",
|
|
76
|
-
"csv-parse": "^5.0
|
|
76
|
+
"csv-parse": "^5.2.0",
|
|
77
77
|
debug: "^4.3.4",
|
|
78
78
|
esprima: "^4.0.1",
|
|
79
|
-
express: "^4.
|
|
79
|
+
express: "^4.18.1",
|
|
80
80
|
globby: "11.0.4",
|
|
81
|
-
ioredis: "^5.0.
|
|
81
|
+
ioredis: "^5.0.6",
|
|
82
82
|
"is-class": "^0.0.9",
|
|
83
83
|
"is-json": "^2.0.1",
|
|
84
84
|
jsonpath: "^1.1.1",
|
|
85
85
|
lodash: "^4.17.21",
|
|
86
|
-
"markdown-it": "^
|
|
86
|
+
"markdown-it": "^13.0.1",
|
|
87
87
|
"mime-types": "^2.1.35",
|
|
88
88
|
mkdirp: "^1.0.4",
|
|
89
89
|
moment: "^2.29.3",
|
|
@@ -95,39 +95,39 @@ var dependencies = {
|
|
|
95
95
|
rimraf: "^3.0.2",
|
|
96
96
|
"sanitize-filename": "^1.6.3",
|
|
97
97
|
slugify: "^1.6.5",
|
|
98
|
-
"socket.io": "^4.
|
|
99
|
-
"socket.io-client": "^4.
|
|
98
|
+
"socket.io": "^4.5.1",
|
|
99
|
+
"socket.io-client": "^4.5.1",
|
|
100
100
|
"socketio-auth": "^0.1.1",
|
|
101
101
|
"swagger-jsdoc": "^6.2.1",
|
|
102
|
-
"swagger-ui-express": "^4.
|
|
102
|
+
"swagger-ui-express": "^4.4.0",
|
|
103
103
|
uuid: "^8.3.2",
|
|
104
104
|
vm2: "^3.9.9",
|
|
105
105
|
"write-yaml": "^1.0.0",
|
|
106
106
|
xlsx: "^0.18.5",
|
|
107
|
-
xregexp: "^5.1.
|
|
108
|
-
yaml: "^2.
|
|
107
|
+
xregexp: "^5.1.1",
|
|
108
|
+
yaml: "^2.1.1"
|
|
109
109
|
};
|
|
110
110
|
var devDependencies = {
|
|
111
|
-
"@babel/core": "^7.
|
|
112
|
-
"@babel/node": "^7.
|
|
113
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
114
|
-
"@babel/preset-env": "^7.
|
|
111
|
+
"@babel/core": "^7.18.5",
|
|
112
|
+
"@babel/node": "^7.18.5",
|
|
113
|
+
"@babel/plugin-transform-runtime": "^7.18.5",
|
|
114
|
+
"@babel/preset-env": "^7.18.2",
|
|
115
115
|
chai: "^4.3.6",
|
|
116
116
|
"chai-as-promised": "^7.1.1",
|
|
117
117
|
"cross-env": "^7.0.3",
|
|
118
|
-
eslint: "^8.
|
|
118
|
+
eslint: "^8.18.0",
|
|
119
119
|
"eslint-config-standard": "^17.0.0",
|
|
120
120
|
"eslint-plugin-import": "^2.26.0",
|
|
121
|
-
"eslint-plugin-n": "^15.
|
|
121
|
+
"eslint-plugin-n": "^15.2.3",
|
|
122
122
|
"eslint-plugin-promise": "^6.0.0",
|
|
123
123
|
"eslint-plugin-standard": "^4.1.0",
|
|
124
124
|
"license-checker": "^25.0.1",
|
|
125
125
|
"license-compatibility-checker": "^0.3.5",
|
|
126
|
-
mocha: "^
|
|
127
|
-
nock: "^13.2.
|
|
128
|
-
"npm-check-updates": "^
|
|
126
|
+
mocha: "^10.0.0",
|
|
127
|
+
nock: "^13.2.7",
|
|
128
|
+
"npm-check-updates": "^14.0.1",
|
|
129
129
|
nyc: "^15.1.0",
|
|
130
|
-
rollup: "^2.
|
|
130
|
+
rollup: "^2.75.6",
|
|
131
131
|
"rollup-plugin-babel": "^4.4.0",
|
|
132
132
|
"rollup-plugin-commonjs": "^10.1.0",
|
|
133
133
|
"rollup-plugin-json": "^4.0.0",
|
|
@@ -276,6 +276,10 @@ var Capabilities = {
|
|
|
276
276
|
SCRIPTING_XLSX_SHEETNAMES_PCONVOS: 'SCRIPTING_XLSX_SHEETNAMES_PCONVOS',
|
|
277
277
|
SCRIPTING_XLSX_SHEETNAMES_UTTERANCES: 'SCRIPTING_XLSX_SHEETNAMES_UTTERANCES',
|
|
278
278
|
SCRIPTING_XLSX_SHEETNAMES_SCRIPTING_MEMORY: 'SCRIPTING_XLSX_SHEETNAMES_SCRIPTING_MEMORY',
|
|
279
|
+
// hidden capability. All newly in Box created testsets will have this as true. CsvCompiler
|
|
280
|
+
// - throws less error (Box reads csv files as utterances, and convo. Compiler cant throw exception if a file is correct, but box tries to load it with incorrect script type)
|
|
281
|
+
// 4 or more colums are compiled just as utterances.
|
|
282
|
+
SCRIPTING_CSV_LEGACY_MODE_OFF: 'SCRIPTING_CSV_LEGACY_MODE_OFF',
|
|
279
283
|
SCRIPTING_CSV_DELIMITER: 'SCRIPTING_CSV_DELIMITER',
|
|
280
284
|
SCRIPTING_CSV_SKIP_HEADER: 'SCRIPTING_CSV_SKIP_HEADER',
|
|
281
285
|
SCRIPTING_CSV_QUOTE: 'SCRIPTING_CSV_QUOTE',
|
|
@@ -285,6 +289,9 @@ var Capabilities = {
|
|
|
285
289
|
SCRIPTING_CSV_MULTIROW_COLUMN_TEXT: 'SCRIPTING_CSV_MULTIROW_COLUMN_TEXT',
|
|
286
290
|
SCRIPTING_CSV_QA_COLUMN_QUESTION: 'SCRIPTING_CSV_QA_COLUMN_QUESTION',
|
|
287
291
|
SCRIPTING_CSV_QA_COLUMN_ANSWER: 'SCRIPTING_CSV_QA_COLUMN_ANSWER',
|
|
292
|
+
SCRIPTING_CSV_UTTERANCE_STARTROW: 'SCRIPTING_CSV_UTTERANCE_STARTROW',
|
|
293
|
+
SCRIPTING_CSV_UTTERANCE_STARTROW_HEADER: 'SCRIPTING_CSV_UTTERANCE_STARTROW_HEADER',
|
|
294
|
+
SCRIPTING_CSV_UTTERANCE_STOP_ON_EMPTY: 'SCRIPTING_CSV_UTTERANCE_STOP_ON_EMPTY',
|
|
288
295
|
SCRIPTING_NORMALIZE_TEXT: 'SCRIPTING_NORMALIZE_TEXT',
|
|
289
296
|
SCRIPTING_ENABLE_MEMORY: 'SCRIPTING_ENABLE_MEMORY',
|
|
290
297
|
SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS: 'SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS',
|
|
@@ -426,6 +433,7 @@ Capabilities.SCRIPTING_XLSX_SHEETNAMES;
|
|
|
426
433
|
Capabilities.SCRIPTING_XLSX_SHEETNAMES_PCONVOS;
|
|
427
434
|
Capabilities.SCRIPTING_XLSX_SHEETNAMES_UTTERANCES;
|
|
428
435
|
Capabilities.SCRIPTING_XLSX_SHEETNAMES_SCRIPTING_MEMORY;
|
|
436
|
+
Capabilities.SCRIPTING_CSV_LEGACY_MODE_OFF;
|
|
429
437
|
Capabilities.SCRIPTING_CSV_DELIMITER;
|
|
430
438
|
Capabilities.SCRIPTING_CSV_SKIP_HEADER;
|
|
431
439
|
Capabilities.SCRIPTING_CSV_QUOTE;
|
|
@@ -435,6 +443,9 @@ Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_SENDER;
|
|
|
435
443
|
Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_TEXT;
|
|
436
444
|
Capabilities.SCRIPTING_CSV_QA_COLUMN_QUESTION;
|
|
437
445
|
Capabilities.SCRIPTING_CSV_QA_COLUMN_ANSWER;
|
|
446
|
+
Capabilities.SCRIPTING_CSV_UTTERANCE_STARTROW;
|
|
447
|
+
Capabilities.SCRIPTING_CSV_UTTERANCE_STARTROW_HEADER;
|
|
448
|
+
Capabilities.SCRIPTING_CSV_UTTERANCE_STOP_ON_EMPTY;
|
|
438
449
|
Capabilities.SCRIPTING_NORMALIZE_TEXT;
|
|
439
450
|
Capabilities.SCRIPTING_ENABLE_MEMORY;
|
|
440
451
|
Capabilities.SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS;
|
|
@@ -5295,6 +5306,8 @@ var CompilerCsv_1 = class CompilerCsv extends CompilerBase_1 {
|
|
|
5295
5306
|
return [];
|
|
5296
5307
|
}
|
|
5297
5308
|
|
|
5309
|
+
const legacyModeOn = !this._GetOptionalCapability(Capabilities.SCRIPTING_CSV_LEGACY_MODE_OFF, false);
|
|
5310
|
+
|
|
5298
5311
|
let delimiter = this._GetOptionalCapability(Capabilities.SCRIPTING_CSV_DELIMITER);
|
|
5299
5312
|
|
|
5300
5313
|
if (!delimiter) {
|
|
@@ -5322,7 +5335,8 @@ var CompilerCsv_1 = class CompilerCsv extends CompilerBase_1 {
|
|
|
5322
5335
|
delimiter,
|
|
5323
5336
|
escape: this.caps[Capabilities.SCRIPTING_CSV_ESCAPE],
|
|
5324
5337
|
quote: this.caps[Capabilities.SCRIPTING_CSV_QUOTE],
|
|
5325
|
-
columns: false
|
|
5338
|
+
columns: false,
|
|
5339
|
+
relax_column_count: true
|
|
5326
5340
|
});
|
|
5327
5341
|
} catch (err) {
|
|
5328
5342
|
throw new Error(`Invalid CSV: ${err.message || err}`);
|
|
@@ -5332,120 +5346,175 @@ var CompilerCsv_1 = class CompilerCsv extends CompilerBase_1 {
|
|
|
5332
5346
|
return [];
|
|
5333
5347
|
}
|
|
5334
5348
|
|
|
5335
|
-
|
|
5336
|
-
|
|
5349
|
+
const columnCount = rows[0].length;
|
|
5350
|
+
debug$c(`Legacy mode ${legacyModeOn ? 'on' : 'off'} rows ${rows.length} columns ${columnCount}`);
|
|
5337
5351
|
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
utterances: rows.slice(1).map(r => r[0])
|
|
5342
|
-
}];
|
|
5343
|
-
this.context.AddUtterances(result);
|
|
5344
|
-
return result;
|
|
5345
|
-
} else {
|
|
5352
|
+
if (scriptType === Constants.SCRIPTING_TYPE_CONVO || scriptType === Constants.SCRIPTING_TYPE_PCONVO) {
|
|
5353
|
+
if (columnCount === 1 || !legacyModeOn && columnCount > 3) {
|
|
5354
|
+
debug$c(`Invalid column count '${columnCount}' in convo mode`);
|
|
5346
5355
|
return [];
|
|
5347
5356
|
}
|
|
5348
|
-
}
|
|
5349
5357
|
|
|
5350
|
-
|
|
5351
|
-
return [];
|
|
5352
|
-
}
|
|
5358
|
+
let header = null;
|
|
5353
5359
|
|
|
5354
|
-
|
|
5360
|
+
if (rows.length > 0 && this.caps[Capabilities.SCRIPTING_CSV_SKIP_HEADER]) {
|
|
5361
|
+
header = rows[0];
|
|
5362
|
+
rows = rows.slice(1);
|
|
5363
|
+
}
|
|
5355
5364
|
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5365
|
+
if (rows.length === 0) {
|
|
5366
|
+
debug$c('Datarows not found in convo mode');
|
|
5367
|
+
return [];
|
|
5368
|
+
}
|
|
5360
5369
|
|
|
5361
|
-
|
|
5362
|
-
return [];
|
|
5363
|
-
}
|
|
5370
|
+
const lineNumberBase = this.caps[Capabilities.SCRIPTING_CSV_SKIP_HEADER] ? 2 : 1;
|
|
5364
5371
|
|
|
5365
|
-
|
|
5372
|
+
if (columnCount === 2) {
|
|
5373
|
+
let colQuestion = DEFAULT_QA_COLUMN_QUESTION;
|
|
5374
|
+
let colAnswer = DEFAULT_QA_COLUMN_ANSWER;
|
|
5366
5375
|
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5376
|
+
if (header) {
|
|
5377
|
+
if (this.caps[Capabilities.SCRIPTING_CSV_QA_COLUMN_QUESTION] !== undefined) {
|
|
5378
|
+
colQuestion = _findColIndex(header, this.caps[Capabilities.SCRIPTING_CSV_QA_COLUMN_QUESTION]);
|
|
5379
|
+
}
|
|
5371
5380
|
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5381
|
+
if (this.caps[Capabilities.SCRIPTING_CSV_QA_COLUMN_ANSWER] !== undefined) {
|
|
5382
|
+
colAnswer = _findColIndex(header, this.caps[Capabilities.SCRIPTING_CSV_QA_COLUMN_ANSWER]);
|
|
5383
|
+
}
|
|
5375
5384
|
}
|
|
5376
5385
|
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5386
|
+
const convos = rows.map((row, i) => new Convo$3(this.context, {
|
|
5387
|
+
header: {
|
|
5388
|
+
name: `L${i + lineNumberBase}`
|
|
5389
|
+
},
|
|
5390
|
+
conversation: [Object.assign({}, linesToConvoStep$2([row[colQuestion]], 'me', this.context, undefined, true), {
|
|
5391
|
+
stepTag: `L${i + lineNumberBase}-Question`
|
|
5392
|
+
}), Object.assign({}, linesToConvoStep$2([row[colAnswer]], 'bot', this.context, undefined, true), {
|
|
5393
|
+
stepTag: `L${i + lineNumberBase}-Answer`
|
|
5394
|
+
})]
|
|
5395
|
+
}));
|
|
5381
5396
|
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
stepTag: `L${i + lineNumberBase}-Question`
|
|
5388
|
-
}), Object.assign({}, linesToConvoStep$2([row[colAnswer]], 'bot', this.context, undefined, true), {
|
|
5389
|
-
stepTag: `L${i + lineNumberBase}-Answer`
|
|
5390
|
-
})]
|
|
5391
|
-
}));
|
|
5397
|
+
if (scriptType === Constants.SCRIPTING_TYPE_CONVO) {
|
|
5398
|
+
this.context.AddConvos(convos);
|
|
5399
|
+
} else if (scriptType === Constants.SCRIPTING_TYPE_PCONVO) {
|
|
5400
|
+
this.context.AddPartialConvos(convos);
|
|
5401
|
+
}
|
|
5392
5402
|
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
} else if (scriptType === Constants.SCRIPTING_TYPE_PCONVO) {
|
|
5396
|
-
this.context.AddPartialConvos(convos);
|
|
5403
|
+
debug$c(`Found 2-column CSV file, treating it as question/answer file, extracted ${convos.length} convos`);
|
|
5404
|
+
return convos;
|
|
5397
5405
|
}
|
|
5398
5406
|
|
|
5399
|
-
|
|
5400
|
-
|
|
5407
|
+
if (columnCount >= 3) {
|
|
5408
|
+
let colConversationId = DEFAULT_MULTIROW_COLUMN_CONVERSATION;
|
|
5409
|
+
let colSender = DEFAULT_MULTIROW_COLUMN_SENDER;
|
|
5410
|
+
let colText = DEFAULT_MULTIROW_COLUMN_TEXT;
|
|
5401
5411
|
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
let colText = DEFAULT_MULTIROW_COLUMN_TEXT;
|
|
5412
|
+
if (header) {
|
|
5413
|
+
if (this.caps[Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_CONVERSATION_ID] !== undefined) {
|
|
5414
|
+
colConversationId = _findColIndex(header, this.caps[Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_CONVERSATION_ID]);
|
|
5415
|
+
}
|
|
5407
5416
|
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
}
|
|
5417
|
+
if (this.caps[Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_SENDER] !== undefined) {
|
|
5418
|
+
colSender = _findColIndex(header, this.caps[Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_SENDER]);
|
|
5419
|
+
}
|
|
5412
5420
|
|
|
5413
|
-
|
|
5414
|
-
|
|
5421
|
+
if (this.caps[Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_TEXT] !== undefined) {
|
|
5422
|
+
colText = _findColIndex(header, this.caps[Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_TEXT]);
|
|
5423
|
+
}
|
|
5415
5424
|
}
|
|
5416
5425
|
|
|
5417
|
-
|
|
5418
|
-
|
|
5426
|
+
const conversationIds = lodash.uniq(rows.map(r => r[colConversationId]));
|
|
5427
|
+
|
|
5428
|
+
const convos = conversationIds.map(conversationId => {
|
|
5429
|
+
const convoRows = rows.map((row, i) => {
|
|
5430
|
+
if (row[colConversationId] === conversationId) {
|
|
5431
|
+
return Object.assign({}, linesToConvoStep$2([row[colText]], row[colSender], this.context, undefined, true), {
|
|
5432
|
+
stepTag: `L${i + lineNumberBase}`
|
|
5433
|
+
});
|
|
5434
|
+
}
|
|
5435
|
+
|
|
5436
|
+
return null;
|
|
5437
|
+
}).filter(c => c);
|
|
5438
|
+
return new Convo$3(this.context, {
|
|
5439
|
+
header: {
|
|
5440
|
+
name: conversationId
|
|
5441
|
+
},
|
|
5442
|
+
conversation: convoRows
|
|
5443
|
+
});
|
|
5444
|
+
});
|
|
5445
|
+
|
|
5446
|
+
if (scriptType === Constants.SCRIPTING_TYPE_CONVO) {
|
|
5447
|
+
this.context.AddConvos(convos);
|
|
5448
|
+
} else if (scriptType === Constants.SCRIPTING_TYPE_PCONVO) {
|
|
5449
|
+
this.context.AddPartialConvos(convos);
|
|
5419
5450
|
}
|
|
5451
|
+
|
|
5452
|
+
debug$c(`Found 3-column CSV file, treating it as multi-row conversation file, extracted ${convos.length} convos`);
|
|
5453
|
+
return convos;
|
|
5454
|
+
}
|
|
5455
|
+
} else if (scriptType === Constants.SCRIPTING_TYPE_UTTERANCES) {
|
|
5456
|
+
if (columnCount === 2 || columnCount === 3 || legacyModeOn && columnCount > 4) {
|
|
5457
|
+
debug$c(`Invalid column count '${columnCount}' in utterances mode`);
|
|
5458
|
+
return [];
|
|
5420
5459
|
}
|
|
5421
5460
|
|
|
5422
|
-
const
|
|
5461
|
+
const result = [];
|
|
5462
|
+
const startRow = this._GetOptionalCapability(Capabilities.SCRIPTING_CSV_UTTERANCE_STARTROW, 2) - 1;
|
|
5423
5463
|
|
|
5424
|
-
const
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5464
|
+
const startRowHeader = this._GetOptionalCapability(Capabilities.SCRIPTING_CSV_UTTERANCE_STARTROW_HEADER);
|
|
5465
|
+
|
|
5466
|
+
const stopOnEmpty = this._GetOptionalCapability(Capabilities.SCRIPTING_CSV_UTTERANCE_STOP_ON_EMPTY);
|
|
5467
|
+
|
|
5468
|
+
for (let col = 0; col < columnCount; col++) {
|
|
5469
|
+
const name = rows[0][col];
|
|
5470
|
+
|
|
5471
|
+
if (!name || name.trim().length === 0) {
|
|
5472
|
+
debug$c(`Column ${col + 1} has no header, skipping`);
|
|
5473
|
+
continue;
|
|
5474
|
+
}
|
|
5475
|
+
|
|
5476
|
+
const uttStruct = {
|
|
5477
|
+
name,
|
|
5478
|
+
utterances: []
|
|
5479
|
+
};
|
|
5480
|
+
let skip = !!startRowHeader;
|
|
5481
|
+
|
|
5482
|
+
const getData = row => {
|
|
5483
|
+
return rows[row][col] ? rows[row][col].trim() : false;
|
|
5484
|
+
}; //
|
|
5485
|
+
|
|
5486
|
+
|
|
5487
|
+
for (let row = startRow; row < rows.length && (skip || !stopOnEmpty || !!getData(row)); row++) {
|
|
5488
|
+
// eslint-disable-line no-unmodified-loop-condition
|
|
5489
|
+
const data = getData(row);
|
|
5490
|
+
|
|
5491
|
+
if (!data) {
|
|
5492
|
+
continue;
|
|
5430
5493
|
}
|
|
5431
5494
|
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
}
|
|
5440
|
-
});
|
|
5495
|
+
if (!skip) {
|
|
5496
|
+
uttStruct.utterances.push(data);
|
|
5497
|
+
} else {
|
|
5498
|
+
if (startRowHeader === rows[row][col]) {
|
|
5499
|
+
skip = false;
|
|
5500
|
+
}
|
|
5501
|
+
}
|
|
5502
|
+
}
|
|
5441
5503
|
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5504
|
+
if (uttStruct.utterances.length === 0) {
|
|
5505
|
+
// liveperson, skipping meta intents
|
|
5506
|
+
debug$c(`Column ${col + 1} has no utterances, skipping`);
|
|
5507
|
+
continue;
|
|
5508
|
+
}
|
|
5509
|
+
|
|
5510
|
+
result.push(uttStruct);
|
|
5446
5511
|
}
|
|
5447
5512
|
|
|
5448
|
-
|
|
5513
|
+
debug$c(`Multi-column utterance file, extracted ${result.length} utterances`);
|
|
5514
|
+
this.context.AddUtterances(result);
|
|
5515
|
+
return result;
|
|
5516
|
+
} else {
|
|
5517
|
+
return [];
|
|
5449
5518
|
}
|
|
5450
5519
|
}
|
|
5451
5520
|
|
|
@@ -5772,7 +5841,7 @@ const {
|
|
|
5772
5841
|
const {
|
|
5773
5842
|
getMatchFunction
|
|
5774
5843
|
} = MatchFunctions;
|
|
5775
|
-
const globPattern = '**/+(*.convo.txt|*.utterances.txt|*.pconvo.txt|*.scriptingmemory.txt|*.xlsx|*.xlsm|*.convo.csv|*.pconvo.csv|*.yaml|*.yml|*.json|*.md|*.markdown)';
|
|
5844
|
+
const globPattern = '**/+(*.convo.txt|*.utterances.txt|*.pconvo.txt|*.scriptingmemory.txt|*.xlsx|*.xlsm|*.convo.csv|*.pconvo.csv|*.utterances.csv|*.yaml|*.yml|*.json|*.md|*.markdown)';
|
|
5776
5845
|
const skipPattern = /^skip[.\-_]/i;
|
|
5777
5846
|
|
|
5778
5847
|
const p = (retryHelper, fn) => {
|
|
@@ -6467,6 +6536,10 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6467
6536
|
result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_CSV, Constants.SCRIPTING_TYPE_CONVO);
|
|
6468
6537
|
} else if (filename.endsWith('.pconvo.csv')) {
|
|
6469
6538
|
result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_CSV, Constants.SCRIPTING_TYPE_PCONVO);
|
|
6539
|
+
} else if (filename.endsWith('.pconvo.csv')) {
|
|
6540
|
+
result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_CSV, Constants.SCRIPTING_TYPE_PCONVO);
|
|
6541
|
+
} else if (filename.endsWith('.utterance.csv')) {
|
|
6542
|
+
result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_CSV, Constants.SCRIPTING_TYPE_UTTERANCES);
|
|
6470
6543
|
} else if (filename.endsWith('.yaml') || filename.endsWith('.yml')) {
|
|
6471
6544
|
result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_YAML, [Constants.SCRIPTING_TYPE_UTTERANCES, Constants.SCRIPTING_TYPE_PCONVO, Constants.SCRIPTING_TYPE_CONVO, Constants.SCRIPTING_TYPE_SCRIPTING_MEMORY]);
|
|
6472
6545
|
} else if (filename.endsWith('.json')) {
|