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

Commit 2bd0fb9

Browse files
authored
Cherry picked changes from main branch (#1314)
* Update orchestratorhelper.ts fixed off by one error * added qna file with \n in it parsing should be ok! * Update orchestratorhelper.test.ts add * Update orchestratorhelper.ts removed normalized tabs on qna file * Update create.ts use input path given from --in, otherwise use one specified in the orchestratorsettings.json * Update create.ts fixed lint errors
1 parent dbf56c6 commit 2bd0fb9

File tree

4 files changed

+15185
-11
lines changed

4 files changed

+15185
-11
lines changed

packages/orchestrator/src/commands/orchestrator/create.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,14 @@ export default class OrchestratorCreate extends Command {
6262

6363
const hasDataSources: boolean = settings.DataSources?.inputs?.length > 0 ?? false;
6464
if (hasDataSources) {
65-
input = settings.DataSources.path;
6665
hierarchical = true;
66+
// do not override the input folder from the --in parameter
67+
const inputPathSpecified: boolean = !Utility.isEmptyString(flags.in);
68+
if (!inputPathSpecified && !Utility.isEmptyString(settings.DataSources.path)) {
69+
input = settings.DataSources.path;
70+
} else {
71+
settings.DataSources.path = flags.in;
72+
}
6773
}
6874

6975
if (refresh) {

packages/orchestratorlib/src/orchestratorhelper.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ export class OrchestratorHelper {
448448
throw new Error('Failed to parse LUIS or JSON file on intent/entity labels');
449449
}
450450
} catch (error: any) {
451+
Utility.debuggingLog(`EXCEPTION calling getIntentsEntitiesUtterances(), error=${error}`);
451452
throw new Error(`Failed parsing lu file ${luFile} ${error.text}`);
452453
}
453454
}
@@ -609,18 +610,10 @@ export class OrchestratorHelper {
609610
}
610611

611612
try {
612-
const newlines: string[] = [];
613-
lines.forEach((line: string) => {
614-
if (line.toLowerCase().indexOf('@qna.pair.source =') < 0) {
615-
newlines.push(line);
616-
}
617-
});
618-
// Utility.debuggingLog('OrchestratorHelper.parseQnaFile() ready to call QnaMakerBuilder.fromContent()');
619-
const qnaNormalized: string = Utility.cleanStringOnTabs(newlines.join('\n')); // ---- NOTE ---- QnaMakerBuilder does not like TAB
620-
const qnaObject: any = await QnaMakerBuilder.fromContent(qnaNormalized);
613+
const qnaObject: any = await QnaMakerBuilder.fromContent(fileContents);
621614
OrchestratorHelper.getQnaQuestionsAsUtterances(qnaObject, hierarchicalLabel, utteranceLabelsMap, utteranceLabelDuplicateMap);
622615
} catch (error: any) {
623-
throw new Error(`Failed parsing qna file ${qnaFile} ${error.text}`);
616+
throw new Error(`Failed parsing qna file ${qnaFile} ${error.text}\n${JSON.stringify(error)}`);
624617
}
625618
}
626619

0 commit comments

Comments
 (0)