This commit is contained in:
Glenn Harper 2023-07-05 14:50:29 -04:00 коммит произвёл GitHub
Родитель 9fff0733c4
Коммит 5b9dd35346
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 37 добавлений и 3 удалений

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

@ -15,6 +15,7 @@ import {
ConversationExpirationEventArgs,
ConversationTranslationCanceledEventArgs,
ConversationTranslationResult,
ResultReason,
Translations
} from "../../sdk/Exports";
import {
@ -191,10 +192,11 @@ export class ConversationServiceAdapter extends ServiceRecognizerBase {
}
const sessionId: string = this.privConversationRequestSession.sessionId;
const conversationMessageType: string = message.conversationMessageType.toLowerCase();
let sendFinal: boolean = false;
try {
switch (message.conversationMessageType.toLowerCase()) {
switch (conversationMessageType) {
case "info":
case "participant_command":
case "command":
@ -432,12 +434,13 @@ export class ConversationServiceAdapter extends ServiceRecognizerBase {
case "final":
const speechPayload: SpeechResponsePayload = SpeechResponsePayload.fromJSON(message.textBody);
const conversationResultReason: ResultReason = (conversationMessageType === "final") ? ResultReason.TranslatedParticipantSpeech : ResultReason.TranslatingParticipantSpeech;
const speechResult: ConversationTranslationResult = new ConversationTranslationResult(speechPayload.participantId,
this.getTranslations(speechPayload.translations),
speechPayload.language,
undefined,
undefined,
speechPayload.id,
conversationResultReason,
speechPayload.recognition,
undefined,
undefined,
@ -478,6 +481,7 @@ export class ConversationServiceAdapter extends ServiceRecognizerBase {
case "translated_message":
const textPayload: TextResponsePayload = TextResponsePayload.fromJSON(message.textBody);
// TODO: (Native parity) a result reason should be set based whether the participantId is ours or not
const textResult: ConversationTranslationResult = new ConversationTranslationResult(textPayload.participantId,
this.getTranslations(textPayload.translations),

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

@ -125,4 +125,34 @@ export enum ResultReason {
* @member ResultReason.VoicesListRetrieved
*/
VoicesListRetrieved,
/**
* Indicates the transcription result contains hypothesis text and its translation(s) for
* other participants in the conversation.
* @member ResultReason.TranslatingParticipantSpeech
*/
TranslatingParticipantSpeech,
/**
* Indicates the transcription result contains final text and corresponding translation(s)
* for other participants in the conversation. Speech Recognition and Translation are now
* complete for this phrase.
* @member ResultReason.TranslatedParticipantSpeech
*/
TranslatedParticipantSpeech,
/**
* <summary>
* Indicates the transcription result contains the instant message and corresponding
* translation(s).
* @member ResultReason.TranslatedInstantMessage
*/
TranslatedInstantMessage,
/**
* Indicates the transcription result contains the instant message for other participants
* in the conversation and corresponding translation(s).
* @member ResultReason.TranslatedParticipantInstantMessage
*/
TranslatedParticipantInstantMessage,
}