Carry the vocabulary hint as prompt from the engines through the worker into every window

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Opus 5.5 committed 2026-10-29 21:44:06 +01:00
1 parent 99b9cd71cd
commit 313892b6df
5 files changed
+67 -1

No files matched your search

+8
View File
@@ -37,6 +37,11 @@ export interface EngineTranscribeOptions {
language?: string;
/** transcribe | translate (multilingual models only). */
task?: WhisperTask;
/**
* "Names and terms" vocabulary hint, raw user text (D-WS2a). Applies to
* every Whisper model, `.en` ones included; empty/undefined = no prompt.
*/
prompt?: string;
/**
* Streaming transcript fragments — append each to the text shown so far.
* Browser engine: token fragments; server engine: whole segments.
@@ -140,6 +145,7 @@ export class BrowserEngine implements Engine {
...(options.language !== undefined &&
options.language !== "auto" && { language: options.language }),
...(options.task !== undefined && { task: options.task }),
...(options.prompt && { prompt: options.prompt }),
};
// Ownership of the audio moves to the worker — zero-copy transfer.
this.worker.postMessage(message, [audio.buffer as ArrayBuffer]);
@@ -282,6 +288,8 @@ export class ServerEngine implements Engine {
params.set("language", options.language);
}
if (options.task !== undefined) params.set("task", options.task);
// Validated + normalized server-side (parseLanguageAndTask, D-WS2a).
if (options.prompt) params.set("prompt", options.prompt);
let response: Response;
try {