feat: add preferred STT languages and fix model settings layout
This commit is contained in:
+4
-1
@@ -63,8 +63,11 @@ export function learningLanguageInstruction(language: Language): string {
|
||||
: "LANGUAGE: Use English for all learner-facing content, including teaching, questions and choices, plans, titles, practice, research summaries, knowledge-graph propositions, and text in generated diagrams, figures and demos. Preserve code, notation, identifiers, proper names and quoted source text. Follow an explicit learner request for a different language or a language-learning exercise when necessary.";
|
||||
}
|
||||
/** Streaming configuration: the language is pinned once at recording start, including reconnects. */
|
||||
export function dictationUrl(language: SttLanguage): string {
|
||||
export function dictationUrl(language: SttLanguage, preferredLanguages: readonly Language[] = []): string {
|
||||
const params = new URLSearchParams({ model: "nova-3", language, encoding: "linear16", sample_rate: "16000", channels: "1", smart_format: "true", punctuate: "true", endpointing: "300" });
|
||||
if (language === "multi") {
|
||||
for (const preferred of new Set(preferredLanguages)) if (isLanguage(preferred)) params.append("language_hint", preferred);
|
||||
}
|
||||
return `wss://api.deepgram.com/v1/listen?${params}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user