setting Seg timeout no longer overrides recognition mode (#630)

This commit is contained in:
Glenn Harper 2023-02-21 17:07:23 -05:00 коммит произвёл GitHub
Родитель 855f094028
Коммит 82b4eb8080
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 14 добавлений и 8 удалений

Просмотреть файл

@ -26,7 +26,7 @@ import {
} from "./Exports";
import { IAuthentication } from "./IAuthentication";
import { IConnectionFactory } from "./IConnectionFactory";
import { RecognizerConfig } from "./RecognizerConfig";
import { RecognitionMode, RecognizerConfig } from "./RecognizerConfig";
import { SpeechConnectionMessage } from "./SpeechConnectionMessage.Internal";
interface CustomModel {
@ -39,11 +39,15 @@ interface PhraseDetection {
onInterim?: { action: string };
onSuccess?: { action: string };
mode?: string;
INTERACTIVE?: {
segmentation: {
mode: "Custom";
segmentationSilenceTimeoutMs: number;
};
INTERACTIVE?: Segmentation;
CONVERSATION?: Segmentation;
DICTATION?: Segmentation;
}
interface Segmentation {
segmentation: {
mode: "Custom";
segmentationSilenceTimeoutMs: number;
};
}
@ -64,9 +68,11 @@ export class SpeechServiceRecognizer extends ServiceRecognizerBase {
const phraseDetection: PhraseDetection = {};
const speechSegmentationTimeout: string = recognizerConfig.parameters.getProperty(PropertyId.Speech_SegmentationSilenceTimeoutMs, undefined);
if (speechSegmentationTimeout !== undefined) {
const mode = recognizerConfig.recognitionMode === RecognitionMode.Conversation ? "CONVERSATION" :
recognizerConfig.recognitionMode === RecognitionMode.Dictation ? "DICTATION" : "INTERACTIVE";
const segmentationSilenceTimeoutMs: number = parseInt(speechSegmentationTimeout, 10);
phraseDetection.mode = "INTERACTIVE";
phraseDetection.INTERACTIVE = {
phraseDetection.mode = mode;
phraseDetection[mode] = {
segmentation: {
mode: "Custom",
segmentationSilenceTimeoutMs