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)
extends UpdateTranscriptPubMsgHdlr
with TranscriptionProviderErrorMsgHdlr
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
case UpdateTranscriptPubMsg.NAME =>
routeGenericMsg[UpdateTranscriptPubMsg](envelope, jsonNode)
case TranscriptionProviderErrorMsg.NAME =>
routeGenericMsg[TranscriptionProviderErrorMsg](envelope, jsonNode)
// GroupChats
case GetGroupChatsReqMsg.NAME =>

View File

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

View File

@ -1,5 +1,12 @@
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
object UpdateTranscriptPubMsg { val NAME = "UpdateTranscriptPubMsg" }
case class UpdateTranscriptPubMsg(header: BbbClientMsgHeader, body: UpdateTranscriptPubMsgBody) extends StandardMsg
@ -14,6 +21,10 @@ case class UpdateTranscriptPubMsgBody(
)
// 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" }
case class TranscriptUpdatedEvtMsg(header: BbbClientMsgHeader, body: TranscriptUpdatedEvtMsgBody) extends BbbCoreMsg
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 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('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_ALWAYS_VISIBLE = Meteor.settings.public.app.audioCaptions.alwaysVisible;
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_LIMIT = CAPTIONS_CONFIG.captionLimit;
@ -29,7 +29,9 @@ function splitTranscript(obj) {
}
}
transcripts.push(result)
if (result.length) {
transcripts.push(result)
}
transcripts.push(currentLine.trim())
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 initSpeechRecognition = () => {
if (!isEnabled() || !isWebSpeechApi()) return null;
if (!isEnabled()) return null;
if (!isWebSpeechApi()) {
setDefaultLocale();
return;
}
if (hasSpeechRecognitionSupport()) {
// Effectivate getVoices
setSpeechVoices();
@ -70,11 +84,7 @@ const initSpeechRecognition = () => {
speechRecognition.continuous = true;
speechRecognition.interimResults = true;
if (useFixedLocale() || localeAsDefaultSelected()) {
setSpeechLocale(getLocale());
} else {
setSpeechLocale(navigator.language);
}
setDefaultLocale();
return speechRecognition;
}

View File

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

View File

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