Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions packages/lu/src/parser/luis/luisCollate.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,17 @@ const buildPrebuiltEntities = function(blob, FinalLUISJSON){
}

const buildModelFeatures = function(blob, FinalLUISJSON){
// do we have model_features?
if (blob.model_features === undefined || blob.model_features.length === 0) {
return
}
blob.model_features.forEach(function (modelFeature) {
let modelFeatureInMaster = helpers.filterMatch(FinalLUISJSON.model_features, 'name', modelFeature.name);
// Find what scope to use in blob
let blobScope = blob.model_features || blob.phraselists || [];
if (blobScope.length === 0) return;

// Find the finalLuisJson scope to use
let finalScope = FinalLUISJSON.model_features || FinalLUISJSON.phraselists;

blobScope.forEach(function (modelFeature) {
let modelFeatureInMaster = helpers.filterMatch(finalScope, 'name', modelFeature.name);
if (modelFeatureInMaster.length === 0) {
FinalLUISJSON.model_features.push(modelFeature);
finalScope.push(modelFeature);
} else {
if (modelFeatureInMaster[0].mode !== modelFeature.mode) {
// error.
Expand Down
27 changes: 27 additions & 0 deletions packages/lu/test/parser/lufile/luQnAFileReference.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,39 @@ describe('Deep reference tests', function() {
done()
})
})

it('Fix for BF-CLI #797 - deep references to phrase lists are handled correctly', function(done) {
let luContent = `
@ phraselist pl_1(interchangeable) =
- pl 1
- pl 1 1

## l_Test
- [l_Test](./Test.lu#Test.Weather)
`;

luMerger.Build([new luObj(luContent, new luOptions('main.lu', true))], false, undefined, findLuFiles)
.then(res => done())
.catch(err => done(err))
})
})

const findLuFiles = async function(srcId, idsToFind){
let retPayload = [];
idsToFind.forEach(ask => {
switch(ask.filePath) {
case './Test.lu':
retPayload.push(new luObj(`
[Phrase list definitions](./phrases.lumodule)

> # Intent definitions
## Test.Weather
- what is the weather`, new luOptions(ask.filePath, false)));
retPayload.push(new luObj(`
@ phraselist pl_2(interchangeable) =
- pl 2
- pl 2 2`, new luOptions(`phrases.lumodule`, true)))
break;
case 'qna1':
retPayload.push(new luObj(`
# ? q1
Expand Down