Fix transcription button highlight (#7222)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-11-22 12:59:25 +04:00 committed by GitHub
parent 33e086adec
commit 1095493fa7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 18 deletions

View File

@ -393,7 +393,7 @@ lk.on(RoomEvent.Connected, () => {
sendMessage({ type: 'connect', value: true })
isCurrentInstanceConnected.set(true)
isRecording.set(lk.isRecording)
initRoomMetadata(lk.metadata)
void initRoomMetadata(lk.metadata)
Analytics.handleEvent(LoveEvents.ConnectedToRoom)
})
lk.on(RoomEvent.Disconnected, () => {
@ -403,7 +403,7 @@ lk.on(RoomEvent.Disconnected, () => {
Analytics.handleEvent(LoveEvents.DisconnectedFromRoom)
})
function initRoomMetadata (metadata: string | undefined): void {
async function initRoomMetadata (metadata: string | undefined): Promise<void> {
let data: RoomMetadata
try {
data = metadata == null || metadata === '' ? {} : JSON.parse(metadata)
@ -420,11 +420,11 @@ function initRoomMetadata (metadata: string | undefined): void {
(data.transcription == null || data.transcription === TranscriptionStatus.Idle) &&
room?.startWithTranscription === true
) {
void startTranscription(room)
await startTranscription(room)
}
if (get(isRecordingAvailable) && data.recording == null && room?.startWithRecording === true) {
void record(room)
if (data.recording == null && room?.startWithRecording === true) {
await record(room)
}
}

View File

@ -115,12 +115,8 @@ export class LoveController {
}
async connect (request: ConnectMeetingRequest): Promise<void> {
if (this.connectedRooms.has(request.roomId)) return
this.roomSidById.set(request.roomId, request.roomSid)
this.connectedRooms.add(request.roomId)
const room = await this.getRoom(request.roomId)
if (room === undefined) {
this.ctx.error('Room not found', request)
this.roomSidById.delete(request.roomId)
@ -128,22 +124,23 @@ export class LoveController {
return
}
this.roomSidById.set(request.roomId, request.roomSid)
this.connectedRooms.add(request.roomId)
this.ctx.info('Connecting', { room: room.name, roomId: room._id })
if (request.transcription) {
const roomTokenName = getTokenRoomName(this.workspace, room.name, room._id)
const isTranscriptionStarted = await startTranscription(this.token, roomTokenName, room.name, request.language)
if (!isTranscriptionStarted) {
this.roomSidById.delete(request.roomId)
this.connectedRooms.delete(request.roomId)
return
}
await this.requestTranscription(room, request.language)
}
await this.createAiParticipant(room)
}
async requestTranscription (room: Room, language: RoomLanguage): Promise<void> {
const roomTokenName = getTokenRoomName(this.workspace, room.name, room._id)
await startTranscription(this.token, roomTokenName, room.name, language)
}
async disconnect (roomId: Ref<Room>): Promise<void> {
this.ctx.info('Disconnecting', { roomId })