Skip to content

Commit

Permalink
feat: verify is Template
Browse files Browse the repository at this point in the history
  • Loading branch information
ItalloDornelas committed Dec 21, 2023
1 parent ddef06c commit 594f4d6
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/syncfusion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export class IaraSyncfusionAdapter
}

insertInference(inference: IaraSpeechRecognitionDetail): void {
if (inference.isFinal) console.log(inference, "insertPARA");
if (inference.richTranscriptModifiers?.length && !inference.isFinal) return;

if (inference.isFirst) {
Expand All @@ -127,11 +128,18 @@ export class IaraSyncfusionAdapter
}

if (inference.richTranscriptModifiers?.length) {
const removeDivTags = inference.richTranscript
.replace(/^<div>/, "")
.replace(/<\/div>$/, "");
this.insertTemplate(removeDivTags);
return;
const phraseOrTemplate =
this._recognition.richTranscriptTemplates.templates[
inference.richTranscriptModifiers[0]
];
const metadata = phraseOrTemplate.metadata as { category?: string };
if (metadata.category === "Template" || !metadata.category) {
const removeDivTags = inference.richTranscript
.replace(/^<div>/, "")
.replace(/<\/div>$/, "");
this.insertTemplate(removeDivTags);
return;
}
}

if (!this._selectionManager) return;
Expand Down

0 comments on commit 594f4d6

Please sign in to comment.