Mark server-live sidecar passes as live mode and cover the stream heartbeat with a test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dc64bb8198
commit
afce794cbf
5 files changed
+41
-8
No files matched your search
@@ -316,6 +316,8 @@ export interface TranscribeDeps {
|
||||
maxUploadBytes?: number;
|
||||
/** Directory for uploaded-PCM temp files. Default: the OS temp dir. */
|
||||
tempDir?: string;
|
||||
/** Blank-line heartbeat period on the ndjson stream (D-021). Default 5 s. */
|
||||
heartbeatIntervalMs?: number;
|
||||
}
|
||||
|
||||
function json(body: unknown, status: number): Response {
|
||||
@@ -409,6 +411,7 @@ async function writeBodyToFile(
|
||||
export function createTranscribeHandlers(deps: TranscribeDeps): TranscribeHandlers {
|
||||
const maxUploadBytes = deps.maxUploadBytes ?? DEFAULT_MAX_UPLOAD_BYTES;
|
||||
const tempDir = deps.tempDir ?? tmpdir();
|
||||
const heartbeatIntervalMs = deps.heartbeatIntervalMs ?? HEARTBEAT_INTERVAL_MS;
|
||||
|
||||
return {
|
||||
async status(request) {
|
||||
@@ -460,7 +463,7 @@ export function createTranscribeHandlers(deps: TranscribeDeps): TranscribeHandle
|
||||
} catch {
|
||||
clearInterval(heartbeat);
|
||||
}
|
||||
}, HEARTBEAT_INTERVAL_MS);
|
||||
}, heartbeatIntervalMs);
|
||||
const chunks: TranscriptChunk[] = [];
|
||||
try {
|
||||
await deps.sidecar.transcribe(
|
||||
|
||||
Reference in new issue
Block a user