Start on live transcription and python sidecar (faster-whisper)

This commit is contained in:
Lucas Winther committed 2026-07-10 09:28:42 +02:00
1 parent 15bf14728a
commit 033ea32968
14 files changed
+1376 -61

No files matched your search

+10 -2
View File
@@ -194,6 +194,7 @@ async function transcribe(message: TranscribeMessage): Promise<void> {
type: "error",
stage: "transcribe",
message: "No model loaded — send a \"load\" message first.",
requestId: message.requestId,
});
return;
}
@@ -204,7 +205,8 @@ async function transcribe(message: TranscribeMessage): Promise<void> {
asr.tokenizer as ConstructorParameters<typeof WhisperTextStreamer>[0],
{
skip_prompt: true,
callback_function: (text: string) => post({ type: "partial", text }),
callback_function: (text: string) =>
post({ type: "partial", text, requestId: message.requestId }),
},
);
@@ -233,6 +235,7 @@ async function transcribe(message: TranscribeMessage): Promise<void> {
type: "result",
text: (single.text ?? "").trim(),
chunks: single.chunks ?? [],
requestId: message.requestId,
};
post(result);
}
@@ -255,7 +258,12 @@ scope.addEventListener("message", (event) => {
break;
case "transcribe":
transcribe(data).catch((error: unknown) => {
post({ type: "error", stage: "transcribe", message: errorMessage(error) });
post({
type: "error",
stage: "transcribe",
message: errorMessage(error),
requestId: data.requestId,
});
});
break;
}