brief-lock-33347
10/18/2025, 2:12 AM@ctx.room.on("room_metadata_changed")
def on_room_metadata_changed(metadata: str):
try:
# if not metadata:
# return
payload = json.loads(metadata)
print(payload)
if payload.get("type") == "say":
text = payload.get("text", "")
if text:
logger.info(f"Executing say command from metadata: '{text}'")
session.say(text)
except Exception as e:
logger.error(f"Error processing room metadata change: {e}", exc_info=True)tall-airline-16756
10/18/2025, 2:13 AMtall-airline-16756
10/18/2025, 2:14 AMbrief-lock-33347
10/18/2025, 2:16 AMasync speak({ message, roomId, agentId, useSSE, jobId }: ISpeak): Promise<TSpeak> {
const { LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET } = this.helperService.initENVs();
const roomService = new RoomServiceClient(LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET);
const payload = JSON.stringify({ type: 'say', text: message, timestamp: Date.now() });
try {
// if (useSSE && jobId) {
// this.logger.log('Implement Server Sent Event Here!');
_`// await this.redisService.publish(init_avatar:${jobId}, {`_
// message,
// jobId,
// status: 'processing',
// success: true,
// });
// return { success: true, message: 'Message sent through sse' };
// }
await roomService.updateRoomMetadata(roomId, payload);
return { success: true, message: 'sent text to livekit room via metadata update' };
} catch (e) {
`const msg = `Failed to send message ${message} to agent ${agentId} in room ${roomId}`;`
this.logger.log(msg);
return { success: false, message: msg };
}
}tall-airline-16756
10/18/2025, 2:17 AMbrief-lock-33347
10/18/2025, 2:20 AMtall-airline-16756
10/18/2025, 2:21 AM