Merge pull request #19608 from lfzawacki/gladia-2.7

fix: Several Gladia transcription fixes
This commit is contained in:
Anton Georgiev 2024-03-07 15:32:54 -05:00 committed by GitHub
commit 4e8a708c95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 108 additions and 14 deletions

View File

@ -4,6 +4,7 @@ import akka.actor.ActorContext
class AudioCaptionsApp2x(implicit val context: ActorContext) class AudioCaptionsApp2x(implicit val context: ActorContext)
extends UpdateTranscriptPubMsgHdlr extends UpdateTranscriptPubMsgHdlr
with TranscriptionProviderErrorMsgHdlr
with AudioFloorChangedVoiceConfEvtMsgHdlr { with AudioFloorChangedVoiceConfEvtMsgHdlr {
} }

View File

@ -0,0 +1,27 @@
package org.bigbluebutton.core.apps.audiocaptions
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.bus.MessageBus
import org.bigbluebutton.core.models.AudioCaptions
import org.bigbluebutton.core.running.LiveMeeting
trait TranscriptionProviderErrorMsgHdlr {
this: AudioCaptionsApp2x =>
def handleTranscriptionProviderErrorMsg(msg: TranscriptionProviderErrorMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
val meetingId = liveMeeting.props.meetingProp.intId
def broadcastEvent(userId: String, errorCode: String, errorMessage: String): Unit = {
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, "nodeJSapp")
val envelope = BbbCoreEnvelope(TranscriptionProviderErrorEvtMsg.NAME, routing)
val header = BbbClientMsgHeader(TranscriptionProviderErrorEvtMsg.NAME, meetingId, userId)
val body = TranscriptionProviderErrorEvtMsgBody(errorCode, errorMessage)
val event = TranscriptionProviderErrorEvtMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
bus.outGW.send(msgEvent)
}
broadcastEvent(msg.header.userId, msg.body.errorCode, msg.body.errorMessage)
}
}

View File

@ -406,6 +406,8 @@ class ReceivedJsonMsgHandlerActor(
// AudioCaptions // AudioCaptions
case UpdateTranscriptPubMsg.NAME => case UpdateTranscriptPubMsg.NAME =>
routeGenericMsg[UpdateTranscriptPubMsg](envelope, jsonNode) routeGenericMsg[UpdateTranscriptPubMsg](envelope, jsonNode)
case TranscriptionProviderErrorMsg.NAME =>
routeGenericMsg[TranscriptionProviderErrorMsg](envelope, jsonNode)
// GroupChats // GroupChats
case GetGroupChatsReqMsg.NAME => case GetGroupChatsReqMsg.NAME =>

View File

@ -583,6 +583,7 @@ class MeetingActor(
// AudioCaptions // AudioCaptions
case m: UpdateTranscriptPubMsg => audioCaptionsApp2x.handle(m, liveMeeting, msgBus) case m: UpdateTranscriptPubMsg => audioCaptionsApp2x.handle(m, liveMeeting, msgBus)
case m: TranscriptionProviderErrorMsg => audioCaptionsApp2x.handleTranscriptionProviderErrorMsg(m, liveMeeting, msgBus)
// GroupChat // GroupChat
case m: CreateGroupChatReqMsg => case m: CreateGroupChatReqMsg =>

View File

@ -1,5 +1,12 @@
package org.bigbluebutton.common2.msgs package org.bigbluebutton.common2.msgs
object TranscriptionProviderErrorMsg { val NAME = "TranscriptionProviderErrorMsg" }
case class TranscriptionProviderErrorMsg(header: BbbClientMsgHeader, body: TranscriptionProviderErrorMsgBody) extends StandardMsg
case class TranscriptionProviderErrorMsgBody(
errorCode: String,
errorMessage: String,
)
// In messages // In messages
object UpdateTranscriptPubMsg { val NAME = "UpdateTranscriptPubMsg" } object UpdateTranscriptPubMsg { val NAME = "UpdateTranscriptPubMsg" }
case class UpdateTranscriptPubMsg(header: BbbClientMsgHeader, body: UpdateTranscriptPubMsgBody) extends StandardMsg case class UpdateTranscriptPubMsg(header: BbbClientMsgHeader, body: UpdateTranscriptPubMsgBody) extends StandardMsg
@ -14,6 +21,10 @@ case class UpdateTranscriptPubMsgBody(
) )
// Out messages // Out messages
object TranscriptionProviderErrorEvtMsg { val NAME = "TranscriptionProviderErrorEvtMsg" }
case class TranscriptionProviderErrorEvtMsg(header: BbbClientMsgHeader, body: TranscriptionProviderErrorEvtMsgBody) extends BbbCoreMsg
case class TranscriptionProviderErrorEvtMsgBody(errorCode: String, errorMessage: String)
object TranscriptUpdatedEvtMsg { val NAME = "TranscriptUpdatedEvtMsg" } object TranscriptUpdatedEvtMsg { val NAME = "TranscriptUpdatedEvtMsg" }
case class TranscriptUpdatedEvtMsg(header: BbbClientMsgHeader, body: TranscriptUpdatedEvtMsgBody) extends BbbCoreMsg case class TranscriptUpdatedEvtMsg(header: BbbClientMsgHeader, body: TranscriptUpdatedEvtMsgBody) extends BbbCoreMsg
case class TranscriptUpdatedEvtMsgBody(transcriptId: String, transcript: String, locale: String, result: Boolean) case class TranscriptUpdatedEvtMsgBody(transcriptId: String, transcript: String, locale: String, result: Boolean)

View File

@ -1 +1 @@
git clone --branch v0.2.1 --depth 1 https://github.com/bigbluebutton/bbb-transcription-controller bbb-transcription-controller git clone --branch v0.2.3 --depth 1 https://github.com/bigbluebutton/bbb-transcription-controller bbb-transcription-controller

View File

@ -1,4 +1,6 @@
import RedisPubSub from '/imports/startup/server/redis'; import RedisPubSub from '/imports/startup/server/redis';
import handleTranscriptUpdated from '/imports/api/audio-captions/server/handlers/transcriptUpdated'; import handleTranscriptUpdated from '/imports/api/audio-captions/server/handlers/transcriptUpdated';
import handleTranscriptionProviderError from '/imports/api/audio-captions/server/handlers/transcriptionProviderError';
RedisPubSub.on('TranscriptUpdatedEvtMsg', handleTranscriptUpdated); RedisPubSub.on('TranscriptUpdatedEvtMsg', handleTranscriptUpdated);
RedisPubSub.on('TranscriptionProviderErrorEvtMsg', handleTranscriptionProviderError);

View File

@ -0,0 +1,38 @@
import Users from '/imports/api/users';
import Logger from '/imports/startup/server/logger';
export default async function handleTranscriptionProviderError({ header, body }) {
const {
meetingId,
userId,
} = header;
const selector = {
meetingId,
userId,
};
const {
errorCode,
errorMessage,
} = body;
const modifier = {
$set: {
transcriptionError: {
code: errorCode,
message: errorMessage,
},
},
};
try {
const numberAffected = await Users.updateAsync(selector, modifier);
if (numberAffected) {
Logger.error(`Transcription error errorCode=${errorCode} errorMessage=${errorMessage} meetingId=${meetingId}`);
}
} catch (err) {
Logger.error(`Problem setting transcription error: ${err}`);
}
}

View File

@ -4,7 +4,7 @@ import Auth from '/imports/ui/services/auth';
const CAPTIONS_CONFIG = Meteor.settings.public.captions; const CAPTIONS_CONFIG = Meteor.settings.public.captions;
const CAPTIONS_ALWAYS_VISIBLE = Meteor.settings.public.app.audioCaptions.alwaysVisible; const CAPTIONS_ALWAYS_VISIBLE = Meteor.settings.public.app.audioCaptions.alwaysVisible;
const CHARACTERS_PER_LINE = CAPTIONS_CONFIG.lineLimit; const CHARACTERS_PER_LINE = CAPTIONS_CONFIG.lineLimit;
const LINES_PER_MESSAGE = CAPTIONS_CONFIG.line; const LINES_PER_MESSAGE = CAPTIONS_CONFIG.lines;
const CAPTION_TIME = CAPTIONS_CONFIG.time; const CAPTION_TIME = CAPTIONS_CONFIG.time;
const CAPTION_LIMIT = CAPTIONS_CONFIG.captionLimit; const CAPTION_LIMIT = CAPTIONS_CONFIG.captionLimit;
@ -29,7 +29,9 @@ function splitTranscript(obj) {
} }
} }
transcripts.push(result) if (result.length) {
transcripts.push(result)
}
transcripts.push(currentLine.trim()) transcripts.push(currentLine.trim())
return transcripts.map((t) => { return { ...obj, transcript: t} }); return transcripts.map((t) => { return { ...obj, transcript: t} });

View File

@ -59,10 +59,24 @@ const setSpeechLocale = (value) => {
} }
}; };
const setDefaultLocale = () => {
if (useFixedLocale() || localeAsDefaultSelected()) {
setSpeechLocale(getLocale());
} else {
setSpeechLocale(navigator.language);
}
}
const useFixedLocale = () => isEnabled() && CONFIG.language.forceLocale; const useFixedLocale = () => isEnabled() && CONFIG.language.forceLocale;
const initSpeechRecognition = () => { const initSpeechRecognition = () => {
if (!isEnabled() || !isWebSpeechApi()) return null; if (!isEnabled()) return null;
if (!isWebSpeechApi()) {
setDefaultLocale();
return;
}
if (hasSpeechRecognitionSupport()) { if (hasSpeechRecognitionSupport()) {
// Effectivate getVoices // Effectivate getVoices
setSpeechVoices(); setSpeechVoices();
@ -70,11 +84,7 @@ const initSpeechRecognition = () => {
speechRecognition.continuous = true; speechRecognition.continuous = true;
speechRecognition.interimResults = true; speechRecognition.interimResults = true;
if (useFixedLocale() || localeAsDefaultSelected()) { setDefaultLocale();
setSpeechLocale(getLocale());
} else {
setSpeechLocale(navigator.language);
}
return speechRecognition; return speechRecognition;
} }

View File

@ -92,7 +92,8 @@ const Captions = ({
'aria-label': intl.formatMessage(intlMessages.hide), 'aria-label': intl.formatMessage(intlMessages.hide),
label: autoTranscription ? intl.formatMessage(intlMessages.title) : name, label: autoTranscription ? intl.formatMessage(intlMessages.title) : name,
}} }}
customRightButton={Service.amICaptionsOwner(ownerId) ? ( customRightButton={dictation ? (
Service.amICaptionsOwner(ownerId) ? (
<span> <span>
<Button <Button
onClick={dictating onClick={dictating
@ -103,7 +104,6 @@ const Captions = ({
: intl.formatMessage(intlMessages.dictationStart)} : intl.formatMessage(intlMessages.dictationStart)}
aria-describedby="dictationBtnDesc" aria-describedby="dictationBtnDesc"
color={dictating ? 'danger' : 'primary'} color={dictating ? 'danger' : 'primary'}
disabled={!dictation}
/> />
<div id="dictationBtnDesc" hidden> <div id="dictationBtnDesc" hidden>
{dictating {dictating
@ -111,7 +111,7 @@ const Captions = ({
: intl.formatMessage(intlMessages.dictationOnDesc)} : intl.formatMessage(intlMessages.dictationOnDesc)}
</div> </div>
</span> </span>
) : ( ) : (
<Button <Button
color="primary" color="primary"
tooltipLabel={intl.formatMessage(intlMessages.takeOwnershipTooltip, { 0: name })} tooltipLabel={intl.formatMessage(intlMessages.takeOwnershipTooltip, { 0: name })}
@ -119,7 +119,7 @@ const Captions = ({
aria-label={intl.formatMessage(intlMessages.takeOwnership)} aria-label={intl.formatMessage(intlMessages.takeOwnership)}
label={intl.formatMessage(intlMessages.takeOwnership)} label={intl.formatMessage(intlMessages.takeOwnership)}
/> />
)} )) : null}
/> />
<PadContainer <PadContainer
externalId={locale} externalId={locale}

View File

@ -245,7 +245,7 @@ public:
# Indicates if the transcription backend should include partial results # Indicates if the transcription backend should include partial results
partialUtterances: true partialUtterances: true
# The minumum length (in seconds) an utterance has to have for we to use it # The minumum length (in seconds) an utterance has to have for we to use it
minUtteranceLength: 3 minUtteranceLength: 1
shortcuts: shortcuts:
openOptions: openOptions:
accesskey: O accesskey: O