Files
redlight/server/config/transcription.js
T
MichelleandClaude Opus 4.8 51b42cfee5
Build & Push Docker Image / build (push) Successful in 4m17s
Build & Push Docker Image / build (release) Successful in 3m57s
feat: add AI summary / transcript integration for recordings
Ported from greenlight-tm: when TRANSCRIPTION_API_URL and
TRANSCRIPTION_API_KEY are set in the .env and the per-room
"AI summary / transcript" setting is enabled, Redlight POSTs to
${TRANSCRIPTION_API_URL}/prompt (header X-Api-Key) as soon as the
"video" format of a recording becomes available.

- transcription.js: service with env gating, timeout and logging
- bbb.js: pass meta_bbb-recording-ready-url on meeting create when the
  room has the setting enabled
- recordings.js: unauthenticated /recording-ready callback that
  verifies BBB's signed_parameters JWT (HS256, shared secret), caches
  the recording and requests the transcription once per recording
  (deduped via transcript_requested_at)
- rooms: new recording_transcript column, accepted on create/update
- branding endpoint exposes transcriptionEnabled so the UI only shows
  the toggle when the server is configured
- RoomDetail: toggle under "Allow recording" (disabled when recording
  is off), de/en i18n
- chore: bump version to 2.4.0

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-14 11:56:45 +02:00

69 lines
2.4 KiB
JavaScript

import { log } from './logger.js';
/**
* Recording transcription / AI summarization integration.
*
* When the per-room "recording transcript" setting is enabled, Redlight POSTs
* to ${TRANSCRIPTION_API_URL}/prompt with header `X-Api-Key: ${TRANSCRIPTION_API_KEY}`
* as soon as the "video" format of a recording becomes available (delivered via
* BBB's recording-ready callback). Leave both env vars empty to disable the
* integration entirely.
*/
const TRANSCRIPTION_API_URL = process.env.TRANSCRIPTION_API_URL || '';
const TRANSCRIPTION_API_KEY = process.env.TRANSCRIPTION_API_KEY || '';
const DEFAULT_PROMPT = 'Summarise the key decisions made in this meeting.';
export function isTranscriptionEnabled() {
return !!(TRANSCRIPTION_API_URL && TRANSCRIPTION_API_KEY);
}
/**
* Request a summary/transcript for a recording. Never throws — failures are
* logged and reported via the boolean return value.
*
* @param {object} opts
* @param {string} opts.meetingId Room UID / BBB meeting ID
* @param {string} opts.recordingId BBB record ID
* @param {string} [opts.prompt] Optional custom prompt
* @returns {Promise<boolean>} true if the request was accepted
*/
export async function requestTranscription({ meetingId, recordingId, prompt }) {
if (!isTranscriptionEnabled()) {
log.server.warn('Transcription request skipped: TRANSCRIPTION_API_URL or TRANSCRIPTION_API_KEY is not configured');
return false;
}
const base = TRANSCRIPTION_API_URL.endsWith('/') ? TRANSCRIPTION_API_URL : `${TRANSCRIPTION_API_URL}/`;
const url = new URL('prompt', base).toString();
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': TRANSCRIPTION_API_KEY,
},
body: JSON.stringify({
prompt: prompt || DEFAULT_PROMPT,
meeting_id: meetingId,
recording_id: recordingId,
}),
signal: AbortSignal.timeout(15_000),
});
if (!response.ok) {
const body = await response.text().catch(() => '');
log.server.error(`Transcription request failed: status=${response.status} body=${body.slice(0, 200)}`);
return false;
}
log.server.info(`Transcription requested for recording ${recordingId} (meeting: ${meetingId})`);
return true;
} catch (err) {
log.server.error(`Transcription request error: ${err.message}`);
return false;
}
}