Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit f330820

Browse files
authored
fix import bug (#1124)
1 parent d9e7d3a commit f330820

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

packages/lu/src/parser/lu/luMerger.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,8 @@ const buildLuJsonObject = async function(luObjArray, log, luis_culture, luSearch
392392
continue
393393
}
394394

395+
// Set includeInCollate in addtionalFilesToParse to be false if current parsedContent's includeInCollate is false
396+
parsedContent.additionalFilesToParse.forEach(addtionFileToParse => addtionFileToParse.includeInCollate = luOb.includeInCollate ? addtionFileToParse.includeInCollate : luOb.includeInCollate)
395397
let foundLuFiles = await luSearchFn(luOb.id, parsedContent.additionalFilesToParse)
396398
for( let i = 0; i < foundLuFiles.length; i++){
397399
if (parsedFiles.includes(foundLuFiles[i].id)) {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# greeting
2+
- hi
3+
- hello
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[common](./common.en-us.lu)
2+
3+
# MyIntent
4+
- test 1
5+
- test 2

packages/lu/test/parser/luis/luisBuilder.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,18 @@ assert.isTrue(luisObject.validate())
9696
assert.equal(luisObject.settings[1].name, 'UseAllTrainingData');
9797
assert.equal(luisObject.settings[1].value, true);
9898
});
99+
100+
it('Intent import can work correctly when imported lu files also have further imports', async () => {
101+
let luFile = `
102+
# Test
103+
- [MyIntent](./test/fixtures/testcases/root.en-us.lu#MyIntent)`;
104+
105+
const luisObject = await LUISBuilder.fromLUAsync(luFile)
106+
107+
assert.equal(luisObject.intents.length, 1);
108+
assert.equal(luisObject.intents[0].name, 'Test');
109+
assert.equal(luisObject.utterances.length, 2);
110+
assert.equal(luisObject.utterances[0].text, 'test 1');
111+
assert.equal(luisObject.utterances[1].text, 'test 2');
112+
});
99113
});

0 commit comments

Comments
 (0)