MCPcopy Create free account
hub / github.com/ACM-VIT/conclave / answerQuestion

Method answerQuestion

apps/web/transcript-worker/src/room.ts:1245–1313  ·  view source on GitHub ↗
(
    viewer: Viewer,
    message: QaAskEnvelope,
  )

Source from the content-addressed store, hash-verified

1243 error: null,
1244 };
1245 this.broadcastSession();
1246 if (!paused) this.flushToLive();
1247 await this.persist();
1248 if (
1249 !paused &&
1250 this.session.transportMode === "sfu" &&
1251 !this.hasSfuRelayViewer()
1252 ) {
1253 await this.beginSfuRelayRecovery();
1254 }
1255 }
1256
1257 private appendAudio(
1258 viewer: Viewer,
1259 audio: string | undefined,
1260 speaker: Partial<TranscriptSpeaker> | undefined,
1261 ): void {
1262 if (this.audioPaused) return;
1263 if (!this.canRelayAudio(viewer)) return;
1264 if (!audio) return;
1265 const pcm = parsePcm16Base64(audio);
1266 if (!pcm) {
1267 this.sendError(viewer, "Transcript audio chunk is not valid PCM audio.");
1268 return;
1269 }
1270 if (pcm.length <= 0) return;
1271 const normalizedSpeaker = normalizeSpeaker(speaker, viewer);
1272 const createdAt = Date.now();
1273 const chunk: HeldChunk = {
1274 audio,
1275 sampleCount: pcm.length,
1276 speaker: normalizedSpeaker,
1277 sequence: this.audioSequence++,
1278 order: this.sequence++,
1279 createdAt,
1280 voice: this.voiceCheckFor(speakerKey(normalizedSpeaker)).push(pcm, createdAt),
1281 turn: this.turnFor(normalizedSpeaker),
1282 sentAt: null,
1283 owner: { kind: "queued" },
1284 savedUnsent: false,
1285 };
1286 if (!this.transcriptionSession && !this.shouldBufferTranscriptionAudio()) return;
1287 this.audio.add(chunk);
1288 this.flushToLive();
1289 if (chunk.owner.kind !== "queued" && this.isController(viewer) && this.session?.controller) {
1290 this.session.controller.lastSeenAt = Date.now();
1291 }
1292 this.saveFirstHeardRun(chunk);
1293 this.enforceAudioBudget();
1294 }
1295
1296 private sendChunk(chunk: HeldChunk): "sent" | "wait" | "failed" {
1297 const session = this.transcriptionSession;
1298 const live = this.liveConnection;
1299 if (!session || !live || this.audioPaused) return "failed";
1300 if (session.withholds?.(chunk.speaker, chunk.voice, chunk.createdAt)) {
1301 chunk.sentAt = Date.now();
1302 chunk.owner = { kind: "unowned" };

Callers 1

handleMessageMethod · 0.95

Calls 6

sendErrorMethod · 0.95
sendMethod · 0.95
trimTextFunction · 0.90
normalizeModelFunction · 0.90
streamQuestionAnswerFunction · 0.90
redactSensitiveTextFunction · 0.90

Tested by

no test coverage detected