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-cjs.js
CHANGED
|
@@ -79,7 +79,7 @@ var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
|
|
|
79
79
|
var bodyParser__default = /*#__PURE__*/_interopDefaultLegacy(bodyParser);
|
|
80
80
|
|
|
81
81
|
var name = "botium-core";
|
|
82
|
-
var version$1 = "1.
|
|
82
|
+
var version$1 = "1.13.0";
|
|
83
83
|
var description = "The Selenium for Chatbots";
|
|
84
84
|
var main = "index.js";
|
|
85
85
|
var module$1 = "dist/botium-es.js";
|
|
@@ -111,22 +111,22 @@ var bugs = {
|
|
|
111
111
|
};
|
|
112
112
|
var homepage = "https://www.botium.ai";
|
|
113
113
|
var dependencies = {
|
|
114
|
-
"@babel/runtime": "^7.
|
|
115
|
-
async: "^3.2.
|
|
114
|
+
"@babel/runtime": "^7.18.3",
|
|
115
|
+
async: "^3.2.4",
|
|
116
116
|
"body-parser": "^1.20.0",
|
|
117
117
|
boolean: "^3.2.0",
|
|
118
118
|
bottleneck: "^2.19.5",
|
|
119
|
-
"csv-parse": "^5.0
|
|
119
|
+
"csv-parse": "^5.2.0",
|
|
120
120
|
debug: "^4.3.4",
|
|
121
121
|
esprima: "^4.0.1",
|
|
122
|
-
express: "^4.
|
|
122
|
+
express: "^4.18.1",
|
|
123
123
|
globby: "11.0.4",
|
|
124
|
-
ioredis: "^5.0.
|
|
124
|
+
ioredis: "^5.0.6",
|
|
125
125
|
"is-class": "^0.0.9",
|
|
126
126
|
"is-json": "^2.0.1",
|
|
127
127
|
jsonpath: "^1.1.1",
|
|
128
128
|
lodash: "^4.17.21",
|
|
129
|
-
"markdown-it": "^
|
|
129
|
+
"markdown-it": "^13.0.1",
|
|
130
130
|
"mime-types": "^2.1.35",
|
|
131
131
|
mkdirp: "^1.0.4",
|
|
132
132
|
moment: "^2.29.3",
|
|
@@ -138,39 +138,39 @@ var dependencies = {
|
|
|
138
138
|
rimraf: "^3.0.2",
|
|
139
139
|
"sanitize-filename": "^1.6.3",
|
|
140
140
|
slugify: "^1.6.5",
|
|
141
|
-
"socket.io": "^4.
|
|
142
|
-
"socket.io-client": "^4.
|
|
141
|
+
"socket.io": "^4.5.1",
|
|
142
|
+
"socket.io-client": "^4.5.1",
|
|
143
143
|
"socketio-auth": "^0.1.1",
|
|
144
144
|
"swagger-jsdoc": "^6.2.1",
|
|
145
|
-
"swagger-ui-express": "^4.
|
|
145
|
+
"swagger-ui-express": "^4.4.0",
|
|
146
146
|
uuid: "^8.3.2",
|
|
147
147
|
vm2: "^3.9.9",
|
|
148
148
|
"write-yaml": "^1.0.0",
|
|
149
149
|
xlsx: "^0.18.5",
|
|
150
|
-
xregexp: "^5.1.
|
|
151
|
-
yaml: "^2.
|
|
150
|
+
xregexp: "^5.1.1",
|
|
151
|
+
yaml: "^2.1.1"
|
|
152
152
|
};
|
|
153
153
|
var devDependencies = {
|
|
154
|
-
"@babel/core": "^7.
|
|
155
|
-
"@babel/node": "^7.
|
|
156
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
157
|
-
"@babel/preset-env": "^7.
|
|
154
|
+
"@babel/core": "^7.18.5",
|
|
155
|
+
"@babel/node": "^7.18.5",
|
|
156
|
+
"@babel/plugin-transform-runtime": "^7.18.5",
|
|
157
|
+
"@babel/preset-env": "^7.18.2",
|
|
158
158
|
chai: "^4.3.6",
|
|
159
159
|
"chai-as-promised": "^7.1.1",
|
|
160
160
|
"cross-env": "^7.0.3",
|
|
161
|
-
eslint: "^8.
|
|
161
|
+
eslint: "^8.18.0",
|
|
162
162
|
"eslint-config-standard": "^17.0.0",
|
|
163
163
|
"eslint-plugin-import": "^2.26.0",
|
|
164
|
-
"eslint-plugin-n": "^15.
|
|
164
|
+
"eslint-plugin-n": "^15.2.3",
|
|
165
165
|
"eslint-plugin-promise": "^6.0.0",
|
|
166
166
|
"eslint-plugin-standard": "^4.1.0",
|
|
167
167
|
"license-checker": "^25.0.1",
|
|
168
168
|
"license-compatibility-checker": "^0.3.5",
|
|
169
|
-
mocha: "^
|
|
170
|
-
nock: "^13.2.
|
|
171
|
-
"npm-check-updates": "^
|
|
169
|
+
mocha: "^10.0.0",
|
|
170
|
+
nock: "^13.2.7",
|
|
171
|
+
"npm-check-updates": "^14.0.1",
|
|
172
172
|
nyc: "^15.1.0",
|
|
173
|
-
rollup: "^2.
|
|
173
|
+
rollup: "^2.75.6",
|
|
174
174
|
"rollup-plugin-babel": "^4.4.0",
|
|
175
175
|
"rollup-plugin-commonjs": "^10.1.0",
|
|
176
176
|
"rollup-plugin-json": "^4.0.0",
|
|
@@ -319,6 +319,10 @@ var Capabilities = {
|
|
|
319
319
|
SCRIPTING_XLSX_SHEETNAMES_PCONVOS: 'SCRIPTING_XLSX_SHEETNAMES_PCONVOS',
|
|
320
320
|
SCRIPTING_XLSX_SHEETNAMES_UTTERANCES: 'SCRIPTING_XLSX_SHEETNAMES_UTTERANCES',
|
|
321
321
|
SCRIPTING_XLSX_SHEETNAMES_SCRIPTING_MEMORY: 'SCRIPTING_XLSX_SHEETNAMES_SCRIPTING_MEMORY',
|
|
322
|
+
// hidden capability. All newly in Box created testsets will have this as true. CsvCompiler
|
|
323
|
+
// - 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)
|
|
324
|
+
// 4 or more colums are compiled just as utterances.
|
|
325
|
+
SCRIPTING_CSV_LEGACY_MODE_OFF: 'SCRIPTING_CSV_LEGACY_MODE_OFF',
|
|
322
326
|
SCRIPTING_CSV_DELIMITER: 'SCRIPTING_CSV_DELIMITER',
|
|
323
327
|
SCRIPTING_CSV_SKIP_HEADER: 'SCRIPTING_CSV_SKIP_HEADER',
|
|
324
328
|
SCRIPTING_CSV_QUOTE: 'SCRIPTING_CSV_QUOTE',
|
|
@@ -328,6 +332,9 @@ var Capabilities = {
|
|
|
328
332
|
SCRIPTING_CSV_MULTIROW_COLUMN_TEXT: 'SCRIPTING_CSV_MULTIROW_COLUMN_TEXT',
|
|
329
333
|
SCRIPTING_CSV_QA_COLUMN_QUESTION: 'SCRIPTING_CSV_QA_COLUMN_QUESTION',
|
|
330
334
|
SCRIPTING_CSV_QA_COLUMN_ANSWER: 'SCRIPTING_CSV_QA_COLUMN_ANSWER',
|
|
335
|
+
SCRIPTING_CSV_UTTERANCE_STARTROW: 'SCRIPTING_CSV_UTTERANCE_STARTROW',
|
|
336
|
+
SCRIPTING_CSV_UTTERANCE_STARTROW_HEADER: 'SCRIPTING_CSV_UTTERANCE_STARTROW_HEADER',
|
|
337
|
+
SCRIPTING_CSV_UTTERANCE_STOP_ON_EMPTY: 'SCRIPTING_CSV_UTTERANCE_STOP_ON_EMPTY',
|
|
331
338
|
SCRIPTING_NORMALIZE_TEXT: 'SCRIPTING_NORMALIZE_TEXT',
|
|
332
339
|
SCRIPTING_ENABLE_MEMORY: 'SCRIPTING_ENABLE_MEMORY',
|
|
333
340
|
SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS: 'SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS',
|
|
@@ -469,6 +476,7 @@ Capabilities.SCRIPTING_XLSX_SHEETNAMES;
|
|
|
469
476
|
Capabilities.SCRIPTING_XLSX_SHEETNAMES_PCONVOS;
|
|
470
477
|
Capabilities.SCRIPTING_XLSX_SHEETNAMES_UTTERANCES;
|
|
471
478
|
Capabilities.SCRIPTING_XLSX_SHEETNAMES_SCRIPTING_MEMORY;
|
|
479
|
+
Capabilities.SCRIPTING_CSV_LEGACY_MODE_OFF;
|
|
472
480
|
Capabilities.SCRIPTING_CSV_DELIMITER;
|
|
473
481
|
Capabilities.SCRIPTING_CSV_SKIP_HEADER;
|
|
474
482
|
Capabilities.SCRIPTING_CSV_QUOTE;
|
|
@@ -478,6 +486,9 @@ Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_SENDER;
|
|
|
478
486
|
Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_TEXT;
|
|
479
487
|
Capabilities.SCRIPTING_CSV_QA_COLUMN_QUESTION;
|
|
480
488
|
Capabilities.SCRIPTING_CSV_QA_COLUMN_ANSWER;
|
|
489
|
+
Capabilities.SCRIPTING_CSV_UTTERANCE_STARTROW;
|
|
490
|
+
Capabilities.SCRIPTING_CSV_UTTERANCE_STARTROW_HEADER;
|
|
491
|
+
Capabilities.SCRIPTING_CSV_UTTERANCE_STOP_ON_EMPTY;
|
|
481
492
|
Capabilities.SCRIPTING_NORMALIZE_TEXT;
|
|
482
493
|
Capabilities.SCRIPTING_ENABLE_MEMORY;
|
|
483
494
|
Capabilities.SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS;
|
|
@@ -5338,6 +5349,8 @@ var CompilerCsv_1 = class CompilerCsv extends CompilerBase_1 {
|
|
|
5338
5349
|
return [];
|
|
5339
5350
|
}
|
|
5340
5351
|
|
|
5352
|
+
const legacyModeOn = !this._GetOptionalCapability(Capabilities.SCRIPTING_CSV_LEGACY_MODE_OFF, false);
|
|
5353
|
+
|
|
5341
5354
|
let delimiter = this._GetOptionalCapability(Capabilities.SCRIPTING_CSV_DELIMITER);
|
|
5342
5355
|
|
|
5343
5356
|
if (!delimiter) {
|
|
@@ -5365,7 +5378,8 @@ var CompilerCsv_1 = class CompilerCsv extends CompilerBase_1 {
|
|
|
5365
5378
|
delimiter,
|
|
5366
5379
|
escape: this.caps[Capabilities.SCRIPTING_CSV_ESCAPE],
|
|
5367
5380
|
quote: this.caps[Capabilities.SCRIPTING_CSV_QUOTE],
|
|
5368
|
-
columns: false
|
|
5381
|
+
columns: false,
|
|
5382
|
+
relax_column_count: true
|
|
5369
5383
|
});
|
|
5370
5384
|
} catch (err) {
|
|
5371
5385
|
throw new Error(`Invalid CSV: ${err.message || err}`);
|
|
@@ -5375,120 +5389,175 @@ var CompilerCsv_1 = class CompilerCsv extends CompilerBase_1 {
|
|
|
5375
5389
|
return [];
|
|
5376
5390
|
}
|
|
5377
5391
|
|
|
5378
|
-
|
|
5379
|
-
|
|
5392
|
+
const columnCount = rows[0].length;
|
|
5393
|
+
debug$c(`Legacy mode ${legacyModeOn ? 'on' : 'off'} rows ${rows.length} columns ${columnCount}`);
|
|
5380
5394
|
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
utterances: rows.slice(1).map(r => r[0])
|
|
5385
|
-
}];
|
|
5386
|
-
this.context.AddUtterances(result);
|
|
5387
|
-
return result;
|
|
5388
|
-
} else {
|
|
5395
|
+
if (scriptType === Constants.SCRIPTING_TYPE_CONVO || scriptType === Constants.SCRIPTING_TYPE_PCONVO) {
|
|
5396
|
+
if (columnCount === 1 || !legacyModeOn && columnCount > 3) {
|
|
5397
|
+
debug$c(`Invalid column count '${columnCount}' in convo mode`);
|
|
5389
5398
|
return [];
|
|
5390
5399
|
}
|
|
5391
|
-
}
|
|
5392
5400
|
|
|
5393
|
-
|
|
5394
|
-
return [];
|
|
5395
|
-
}
|
|
5401
|
+
let header = null;
|
|
5396
5402
|
|
|
5397
|
-
|
|
5403
|
+
if (rows.length > 0 && this.caps[Capabilities.SCRIPTING_CSV_SKIP_HEADER]) {
|
|
5404
|
+
header = rows[0];
|
|
5405
|
+
rows = rows.slice(1);
|
|
5406
|
+
}
|
|
5398
5407
|
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5408
|
+
if (rows.length === 0) {
|
|
5409
|
+
debug$c('Datarows not found in convo mode');
|
|
5410
|
+
return [];
|
|
5411
|
+
}
|
|
5403
5412
|
|
|
5404
|
-
|
|
5405
|
-
return [];
|
|
5406
|
-
}
|
|
5413
|
+
const lineNumberBase = this.caps[Capabilities.SCRIPTING_CSV_SKIP_HEADER] ? 2 : 1;
|
|
5407
5414
|
|
|
5408
|
-
|
|
5415
|
+
if (columnCount === 2) {
|
|
5416
|
+
let colQuestion = DEFAULT_QA_COLUMN_QUESTION;
|
|
5417
|
+
let colAnswer = DEFAULT_QA_COLUMN_ANSWER;
|
|
5409
5418
|
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5419
|
+
if (header) {
|
|
5420
|
+
if (this.caps[Capabilities.SCRIPTING_CSV_QA_COLUMN_QUESTION] !== undefined) {
|
|
5421
|
+
colQuestion = _findColIndex(header, this.caps[Capabilities.SCRIPTING_CSV_QA_COLUMN_QUESTION]);
|
|
5422
|
+
}
|
|
5414
5423
|
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5424
|
+
if (this.caps[Capabilities.SCRIPTING_CSV_QA_COLUMN_ANSWER] !== undefined) {
|
|
5425
|
+
colAnswer = _findColIndex(header, this.caps[Capabilities.SCRIPTING_CSV_QA_COLUMN_ANSWER]);
|
|
5426
|
+
}
|
|
5418
5427
|
}
|
|
5419
5428
|
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5429
|
+
const convos = rows.map((row, i) => new Convo$3(this.context, {
|
|
5430
|
+
header: {
|
|
5431
|
+
name: `L${i + lineNumberBase}`
|
|
5432
|
+
},
|
|
5433
|
+
conversation: [Object.assign({}, linesToConvoStep$2([row[colQuestion]], 'me', this.context, undefined, true), {
|
|
5434
|
+
stepTag: `L${i + lineNumberBase}-Question`
|
|
5435
|
+
}), Object.assign({}, linesToConvoStep$2([row[colAnswer]], 'bot', this.context, undefined, true), {
|
|
5436
|
+
stepTag: `L${i + lineNumberBase}-Answer`
|
|
5437
|
+
})]
|
|
5438
|
+
}));
|
|
5424
5439
|
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
stepTag: `L${i + lineNumberBase}-Question`
|
|
5431
|
-
}), Object.assign({}, linesToConvoStep$2([row[colAnswer]], 'bot', this.context, undefined, true), {
|
|
5432
|
-
stepTag: `L${i + lineNumberBase}-Answer`
|
|
5433
|
-
})]
|
|
5434
|
-
}));
|
|
5440
|
+
if (scriptType === Constants.SCRIPTING_TYPE_CONVO) {
|
|
5441
|
+
this.context.AddConvos(convos);
|
|
5442
|
+
} else if (scriptType === Constants.SCRIPTING_TYPE_PCONVO) {
|
|
5443
|
+
this.context.AddPartialConvos(convos);
|
|
5444
|
+
}
|
|
5435
5445
|
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
} else if (scriptType === Constants.SCRIPTING_TYPE_PCONVO) {
|
|
5439
|
-
this.context.AddPartialConvos(convos);
|
|
5446
|
+
debug$c(`Found 2-column CSV file, treating it as question/answer file, extracted ${convos.length} convos`);
|
|
5447
|
+
return convos;
|
|
5440
5448
|
}
|
|
5441
5449
|
|
|
5442
|
-
|
|
5443
|
-
|
|
5450
|
+
if (columnCount >= 3) {
|
|
5451
|
+
let colConversationId = DEFAULT_MULTIROW_COLUMN_CONVERSATION;
|
|
5452
|
+
let colSender = DEFAULT_MULTIROW_COLUMN_SENDER;
|
|
5453
|
+
let colText = DEFAULT_MULTIROW_COLUMN_TEXT;
|
|
5444
5454
|
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
let colText = DEFAULT_MULTIROW_COLUMN_TEXT;
|
|
5455
|
+
if (header) {
|
|
5456
|
+
if (this.caps[Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_CONVERSATION_ID] !== undefined) {
|
|
5457
|
+
colConversationId = _findColIndex(header, this.caps[Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_CONVERSATION_ID]);
|
|
5458
|
+
}
|
|
5450
5459
|
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
}
|
|
5460
|
+
if (this.caps[Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_SENDER] !== undefined) {
|
|
5461
|
+
colSender = _findColIndex(header, this.caps[Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_SENDER]);
|
|
5462
|
+
}
|
|
5455
5463
|
|
|
5456
|
-
|
|
5457
|
-
|
|
5464
|
+
if (this.caps[Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_TEXT] !== undefined) {
|
|
5465
|
+
colText = _findColIndex(header, this.caps[Capabilities.SCRIPTING_CSV_MULTIROW_COLUMN_TEXT]);
|
|
5466
|
+
}
|
|
5458
5467
|
}
|
|
5459
5468
|
|
|
5460
|
-
|
|
5461
|
-
|
|
5469
|
+
const conversationIds = lodash__default["default"].uniq(rows.map(r => r[colConversationId]));
|
|
5470
|
+
|
|
5471
|
+
const convos = conversationIds.map(conversationId => {
|
|
5472
|
+
const convoRows = rows.map((row, i) => {
|
|
5473
|
+
if (row[colConversationId] === conversationId) {
|
|
5474
|
+
return Object.assign({}, linesToConvoStep$2([row[colText]], row[colSender], this.context, undefined, true), {
|
|
5475
|
+
stepTag: `L${i + lineNumberBase}`
|
|
5476
|
+
});
|
|
5477
|
+
}
|
|
5478
|
+
|
|
5479
|
+
return null;
|
|
5480
|
+
}).filter(c => c);
|
|
5481
|
+
return new Convo$3(this.context, {
|
|
5482
|
+
header: {
|
|
5483
|
+
name: conversationId
|
|
5484
|
+
},
|
|
5485
|
+
conversation: convoRows
|
|
5486
|
+
});
|
|
5487
|
+
});
|
|
5488
|
+
|
|
5489
|
+
if (scriptType === Constants.SCRIPTING_TYPE_CONVO) {
|
|
5490
|
+
this.context.AddConvos(convos);
|
|
5491
|
+
} else if (scriptType === Constants.SCRIPTING_TYPE_PCONVO) {
|
|
5492
|
+
this.context.AddPartialConvos(convos);
|
|
5462
5493
|
}
|
|
5494
|
+
|
|
5495
|
+
debug$c(`Found 3-column CSV file, treating it as multi-row conversation file, extracted ${convos.length} convos`);
|
|
5496
|
+
return convos;
|
|
5497
|
+
}
|
|
5498
|
+
} else if (scriptType === Constants.SCRIPTING_TYPE_UTTERANCES) {
|
|
5499
|
+
if (columnCount === 2 || columnCount === 3 || legacyModeOn && columnCount > 4) {
|
|
5500
|
+
debug$c(`Invalid column count '${columnCount}' in utterances mode`);
|
|
5501
|
+
return [];
|
|
5463
5502
|
}
|
|
5464
5503
|
|
|
5465
|
-
const
|
|
5504
|
+
const result = [];
|
|
5505
|
+
const startRow = this._GetOptionalCapability(Capabilities.SCRIPTING_CSV_UTTERANCE_STARTROW, 2) - 1;
|
|
5466
5506
|
|
|
5467
|
-
const
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5507
|
+
const startRowHeader = this._GetOptionalCapability(Capabilities.SCRIPTING_CSV_UTTERANCE_STARTROW_HEADER);
|
|
5508
|
+
|
|
5509
|
+
const stopOnEmpty = this._GetOptionalCapability(Capabilities.SCRIPTING_CSV_UTTERANCE_STOP_ON_EMPTY);
|
|
5510
|
+
|
|
5511
|
+
for (let col = 0; col < columnCount; col++) {
|
|
5512
|
+
const name = rows[0][col];
|
|
5513
|
+
|
|
5514
|
+
if (!name || name.trim().length === 0) {
|
|
5515
|
+
debug$c(`Column ${col + 1} has no header, skipping`);
|
|
5516
|
+
continue;
|
|
5517
|
+
}
|
|
5518
|
+
|
|
5519
|
+
const uttStruct = {
|
|
5520
|
+
name,
|
|
5521
|
+
utterances: []
|
|
5522
|
+
};
|
|
5523
|
+
let skip = !!startRowHeader;
|
|
5524
|
+
|
|
5525
|
+
const getData = row => {
|
|
5526
|
+
return rows[row][col] ? rows[row][col].trim() : false;
|
|
5527
|
+
}; //
|
|
5528
|
+
|
|
5529
|
+
|
|
5530
|
+
for (let row = startRow; row < rows.length && (skip || !stopOnEmpty || !!getData(row)); row++) {
|
|
5531
|
+
// eslint-disable-line no-unmodified-loop-condition
|
|
5532
|
+
const data = getData(row);
|
|
5533
|
+
|
|
5534
|
+
if (!data) {
|
|
5535
|
+
continue;
|
|
5473
5536
|
}
|
|
5474
5537
|
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
}
|
|
5483
|
-
});
|
|
5538
|
+
if (!skip) {
|
|
5539
|
+
uttStruct.utterances.push(data);
|
|
5540
|
+
} else {
|
|
5541
|
+
if (startRowHeader === rows[row][col]) {
|
|
5542
|
+
skip = false;
|
|
5543
|
+
}
|
|
5544
|
+
}
|
|
5545
|
+
}
|
|
5484
5546
|
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5547
|
+
if (uttStruct.utterances.length === 0) {
|
|
5548
|
+
// liveperson, skipping meta intents
|
|
5549
|
+
debug$c(`Column ${col + 1} has no utterances, skipping`);
|
|
5550
|
+
continue;
|
|
5551
|
+
}
|
|
5552
|
+
|
|
5553
|
+
result.push(uttStruct);
|
|
5489
5554
|
}
|
|
5490
5555
|
|
|
5491
|
-
|
|
5556
|
+
debug$c(`Multi-column utterance file, extracted ${result.length} utterances`);
|
|
5557
|
+
this.context.AddUtterances(result);
|
|
5558
|
+
return result;
|
|
5559
|
+
} else {
|
|
5560
|
+
return [];
|
|
5492
5561
|
}
|
|
5493
5562
|
}
|
|
5494
5563
|
|
|
@@ -5815,7 +5884,7 @@ const {
|
|
|
5815
5884
|
const {
|
|
5816
5885
|
getMatchFunction
|
|
5817
5886
|
} = MatchFunctions;
|
|
5818
|
-
const globPattern = '**/+(*.convo.txt|*.utterances.txt|*.pconvo.txt|*.scriptingmemory.txt|*.xlsx|*.xlsm|*.convo.csv|*.pconvo.csv|*.yaml|*.yml|*.json|*.md|*.markdown)';
|
|
5887
|
+
const globPattern = '**/+(*.convo.txt|*.utterances.txt|*.pconvo.txt|*.scriptingmemory.txt|*.xlsx|*.xlsm|*.convo.csv|*.pconvo.csv|*.utterances.csv|*.yaml|*.yml|*.json|*.md|*.markdown)';
|
|
5819
5888
|
const skipPattern = /^skip[.\-_]/i;
|
|
5820
5889
|
|
|
5821
5890
|
const p = (retryHelper, fn) => {
|
|
@@ -6510,6 +6579,10 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6510
6579
|
result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_CSV, Constants.SCRIPTING_TYPE_CONVO);
|
|
6511
6580
|
} else if (filename.endsWith('.pconvo.csv')) {
|
|
6512
6581
|
result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_CSV, Constants.SCRIPTING_TYPE_PCONVO);
|
|
6582
|
+
} else if (filename.endsWith('.pconvo.csv')) {
|
|
6583
|
+
result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_CSV, Constants.SCRIPTING_TYPE_PCONVO);
|
|
6584
|
+
} else if (filename.endsWith('.utterance.csv')) {
|
|
6585
|
+
result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_CSV, Constants.SCRIPTING_TYPE_UTTERANCES);
|
|
6513
6586
|
} else if (filename.endsWith('.yaml') || filename.endsWith('.yml')) {
|
|
6514
6587
|
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]);
|
|
6515
6588
|
} else if (filename.endsWith('.json')) {
|