conversations come back as conversations
A probe on the torch stage worker (~/dockers/torch-worker) runs beside every transcription and decides what the recording is: solo dictation returns as paragraphs exactly as before, several voices return speaker-labeled with conversation: true. Nobody declares which — the caller cannot know. Transcription and the worker each get a serial FIFO queue on their own resource, so the probe costs a solo memo nothing and multi-user traffic stays fair. The worker is optional and best-effort throughout: unreachable or failing, everything still transcribes, just never labeled. Speaker attribution is segment-granularity by maximal turn overlap — whisper.cpp's own timestamps, no alignment stage. If boundaries prove sloppy, wav2vec2 alignment returns as a worker endpoint. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+9
-2
@@ -15,7 +15,12 @@ import { DATA_PATH } from '@@/data-path';
|
||||
const CONFIG_DIR = join(DATA_PATH, 'transcribe');
|
||||
const CONFIG_PATH = join(CONFIG_DIR, 'config.json');
|
||||
|
||||
export type TranscribeConfig = { url: string };
|
||||
export type TranscribeConfig = {
|
||||
url: string;
|
||||
/** The torch stage worker (diarization + conversation probe). Optional: without it the plugin
|
||||
* still transcribes, it just never labels speakers — degradation, not failure. */
|
||||
workerUrl?: string;
|
||||
};
|
||||
|
||||
// Cached across requests; invalidated only by `setConfig`. A single small file re-read on every
|
||||
// transcription would be a needless stat + parse on the hot path.
|
||||
@@ -26,7 +31,9 @@ async function loadConfig(): Promise<TranscribeConfig | null> {
|
||||
if (!(await file.exists())) return null;
|
||||
try {
|
||||
const parsed = (await file.json()) as Partial<TranscribeConfig>;
|
||||
return typeof parsed.url === 'string' && parsed.url ? { url: parsed.url } : null;
|
||||
if (typeof parsed.url !== 'string' || !parsed.url) return null;
|
||||
const workerUrl = typeof parsed.workerUrl === 'string' && parsed.workerUrl ? parsed.workerUrl : undefined;
|
||||
return { url: parsed.url, ...(workerUrl ? { workerUrl } : {}) };
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user