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 1 commit
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
7 changes: 7 additions & 0 deletions packages/orchestratorlib/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ export class OrchestratorBuild {
Utility.debuggingLog(`OrchestratorBuild.syncLabelResolverEx(), subject.utteranceEntityLabelsMap.size=${subject.utteranceEntityLabelsMap.size}`);
Utility.debuggingLog(`OrchestratorBuild.syncLabelResolverEx(), target.utteranceLabelsMap.size=${target.utteranceLabelsMap.size}`);
Utility.debuggingLog(`OrchestratorBuild.syncLabelResolverEx(), target.utteranceEntityLabelsMap.size=${target.utteranceEntityLabelsMap.size}`);

if (subject.utteranceLabelsMap.size === 0) {
Utility.debuggingLog('OrchestratorBuild.syncLabelResolverEx(), ready to call LabelResolver.addBatch()');
LabelResolver.addBatch(target);
Utility.debuggingLog('OrchestratorBuild.syncLabelResolverEx(), after calling LabelResolver.addBatch()');
}

// ---- NOTE ---- delete example intent label if it is not in target.
subject.utteranceLabelsMap.forEach((labels: Set<string>, utterance: string) => {
if (target.utteranceLabelsMap.has(utterance)) {
Expand Down
59 changes: 51 additions & 8 deletions packages/orchestratorlib/test/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,37 @@ import {UnitTestHelper} from './utility.test';

describe('OrchestratorCreateTests', () => {
const baseModelPath: string = path.resolve('./resources/model/model_dte_bert_3l');
const inputPath: string = './test/fixtures/dispatch';
const inputPath2: string = path.resolve('./test/fixtures/newDispatch');
const snapshotPath: string = path.join(inputPath, OrchestratorHelper.SnapshotFileName);

beforeEach(async () => {
Utility.debuggingLog('OrchestratorCreateTests - downloading a base nerual network language model for unit test');
await UnitTestHelper.downloadModelFileForTest(
baseModelPath,
OrchestratorBaseModel.defaultHandler,
OrchestratorBaseModel.defaultHandler);

if (Utility.exists(snapshotPath)) {
Utility.deleteFile(snapshotPath);
}
});

afterEach(async () => {
if (Utility.exists(inputPath2)) {
Utility.deleteFolderRecursive(inputPath2);
}
});

it('Create Dispatch Snapshot', async function (): Promise<void> {
it('Create Dispatch Snapshot - no existing snapshot', async function (): Promise<void> {
Utility.resetFlagToPrintDebuggingLogToConsole(UnitTestHelper.getDefaultUnitTestDebuggingLogFlag());
this.timeout(UnitTestHelper.getDefaultFunctionalTestTimeout());
const outputPath: string = './test/fixtures/dispatch';

const snapshotPath: string = path.join(outputPath, OrchestratorHelper.SnapshotFileName);
if (Utility.exists(snapshotPath)) {
Utility.deleteFile(snapshotPath);
}
await OrchestratorCreate.runAsync(
baseModelPath,
'',
outputPath,
outputPath,
inputPath,
inputPath,
true);

assert.ok(Utility.exists(snapshotPath));
Expand All @@ -50,6 +58,41 @@ describe('OrchestratorCreateTests', () => {
assert.ok(snapshotContent.indexOf('Weather') > 0);
});

it('Create Dispatch Snapshot - incremental', async function (): Promise<void> {
Utility.resetFlagToPrintDebuggingLogToConsole(UnitTestHelper.getDefaultUnitTestDebuggingLogFlag());
this.timeout(UnitTestHelper.getDefaultFunctionalTestTimeout());

await OrchestratorCreate.runAsync(
baseModelPath,
'',
inputPath,
inputPath,
true);

assert.ok(Utility.exists(snapshotPath));
const snapshotContent: string = OrchestratorHelper.readFile(snapshotPath);
assert.ok(snapshotContent.indexOf('HomeAutomation') > 0);
assert.ok(snapshotContent.indexOf('Weather') > 0);

fs.ensureDirSync(inputPath2);
fs.copySync(path.resolve(inputPath), inputPath2);
fs.copySync(path.resolve('./test/fixtures/Gaming.lu'), path.join(inputPath2, 'Gaming.lu'));

await OrchestratorCreate.runAsync(
baseModelPath,
'',
inputPath2,
inputPath,
true);

assert.ok(Utility.exists(snapshotPath));
const snapshotContent2: string = OrchestratorHelper.readFile(snapshotPath);
assert.ok(snapshotContent2.length > snapshotContent.length);
assert.ok(snapshotContent2.indexOf('HomeAutomation') > 0);
assert.ok(snapshotContent2.indexOf('Weather') > 0);
assert.ok(snapshotContent2.indexOf('Gaming') > 0);
});

it('Create Snapshot - LU file with reference to other LU file', async function (): Promise<void> {
Utility.resetFlagToPrintDebuggingLogToConsole(UnitTestHelper.getDefaultUnitTestDebuggingLogFlag());
this.timeout(UnitTestHelper.getDefaultFunctionalTestTimeout());
Expand Down
46 changes: 46 additions & 0 deletions packages/orchestratorlib/test/fixtures/Gaming.lu
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## gaming.invite_player
- Invite {@gaming.contact_name=Cody} to party
- {@gaming.contact_name=Bata Bing}
- Invite {@gaming.contact_name=Carlos} to party
- Invite {@gaming.contact_name=James pendergast} to the party
- Invite {@gaming.contact_name=Zach} to party.
- Invite {@gaming.contact_name=Devin} to the party
- I'm in there
- Invite {@gaming.contact_name=master chief} the game
- Invite {@gaming.contact_name=Gavin robber 922} 2 a party
- Invite {@gaming.contact_name=Dylan} to the party
- Invite {@gaming.contact_name=crazy ex Tucker} to {@gaming.game_title=the part}
- Just asking to join a party

@ intent gaming.invite_player

## gaming.invite_party
- The first one
- Invite party.

@ intent gaming.invite_party

## gaming.leave_party
- Leave party

@ intent gaming.leave_party

## gaming.find_players
- What is {@gaming.contact_name=blade runner 223} in my friends list?

@ intent gaming.find_players

## gaming.show_friends
- Who are my Xbox my best friends ?
- Go to friends list

@ intent gaming.show_friends

## gaming.start_party
- Join party

@ intent gaming.start_party

@ ml gaming.contact_name

@ ml gaming.game_title