feat: enforce aggressive hybrid mode for names-only captions

Made-with: Cursor
This commit is contained in:
ValueOn AG 2026-02-26 09:22:07 +01:00
parent 39a422af25
commit 77aa4f3d07

View file

@ -926,14 +926,9 @@ export class BotOrchestrator {
this._page,
this._logger,
(entry) => {
const transferMode = this._getEffectiveTransferMode();
if (transferMode === 'audio') {
// In audio mode, captions are only used as speaker hints.
this._sendTranscript(entry.speaker, entry.text, entry.isFinal, 'speakerHint');
} else {
this._sendTranscript(entry.speaker, entry.text, entry.isFinal, 'caption');
this._callbacks.onTranscript(entry);
}
// Aggressive hybrid mode: captions are always speaker hints only.
// Caption text is never persisted as transcript due to language quality issues.
this._sendTranscript(entry.speaker, entry.text, entry.isFinal, 'speakerHint');
},
this._options.language
);
@ -958,11 +953,8 @@ export class BotOrchestrator {
// This ensures Teams gets our controlled audio stream when it calls getUserMedia
await this._audioProcedure.injectAudioOverride();
// Inject audio capture (WebRTC interception) if transfer mode requires it
const transferMode = this._getEffectiveTransferMode();
if (transferMode === 'audio') {
await this._audioCaptureProcedure!.injectCaptureOverride();
}
// Aggressive hybrid mode: always capture meeting audio as transcript source.
await this._audioCaptureProcedure!.injectCaptureOverride();
// Handle page errors
this._page.on('pageerror', (error) => {
@ -1108,32 +1100,15 @@ export class BotOrchestrator {
}
}
/**
* Subscribe to captions only as speaker hints (without enabling captions flow).
* This supports hybrid mode: audio text + caption-based speaker names.
*/
private async _enableSpeakerHintsFromCaptions(): Promise<void> {
try {
await this._captionsProcedure!.subscribeToCaptions();
this._logger.info('Speaker hints from captions subscribed (audio mode)');
} catch (error) {
this._logger.warn('Could not subscribe to captions for speaker hints:', error);
}
}
/**
* Enable transcript capture (captions or audio) based on transfer mode.
*/
private async _enableTranscriptCapture(): Promise<void> {
const transferMode = this._getEffectiveTransferMode();
this._logger.info(`Transfer mode: ${transferMode} (configured: ${this._options.transferMode || 'auto'})`);
if (transferMode === 'caption') {
await this._enableCaptions();
} else {
await this._enableAudioCapture();
await this._enableSpeakerHintsFromCaptions();
}
this._logger.info(
`Aggressive hybrid mode active: audio STT + background captions for speaker hints (configured transferMode: ${this._options.transferMode || 'auto'})`,
);
await this._enableAudioCapture();
await this._enableCaptions();
}
/**