YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(meetings): honor in-app language selection for live transcription
Louis Beaumontecffbc3622b1
diff --git a/crates/screenpipe-engine/src/recording_config.rs b/crates/screenpipe-engine/src/recording_config.rsindex 1d783260f..f96746e3e 100644--- a/crates/screenpipe-engine/src/recording_config.rs+++ b/crates/screenpipe-engine/src/recording_config.rs@@ -244,11 +244,7 @@ impl RecordingConfig {"deepgram-live" | "deepgram_live" => Some(settings.deepgram_api_key.clone()),_ => None,},- settings- .languages- .iter()- .find(|s| s.as_str() != "default")- .cloned(),+ single_language_code(&settings.languages),settings.effective_user_name().map(str::to_string),),audio_devices: settings.audio_devices.clone(),@@ -442,6 +438,24 @@ impl RecordingConfig {}}+/// Picks the single language to force on the live meeting transcription+/// websocket. Deepgram's streaming API either forces one language+/// (`language=<code>`) or code-switches across many (`language=multi`); unlike+/// the batch API there is no per-stream allow-list. So we force a language only+/// when the user selected exactly one, and otherwise return `None` to let the+/// live path fall back to multilingual auto-detection. Strings are canonicalized+/// through `Language` so a settings value of either "spanish" or "es" yields "es".+fn single_language_code(languages: &[String]) -> Option<String> {+ let mut selected = languages+ .iter()+ .filter(|s| s.as_str() != "default")+ .filter_map(|s| s.parse::<Language>().ok());+ match (selected.next(), selected.next()) {+ (Some(only), None) => Some(only.as_lang_code().to_string()),+ _ => None,+ }+}+#[cfg(test)]mod tests {use super::*;@@ -493,4 +507,46 @@ mod tests {assert_eq!(c.listen_address, Ipv4Addr::LOCALHOST);assert!(!c.api_auth);}++ fn langs(items: &[&str]) -> Vec<String> {+ items.iter().map(|s| s.to_string()).collect()+ }++ #[test]+ fn no_language_means_multilingual() {+ // Empty or "default"-only selections must not force a language; the+ // live websocket then falls back to `language=multi`.+ assert_eq!(single_language_code(&[]), None);+ assert_eq!(single_language_code(&langs(&["default"])), None);+ }++ #[test]+ fn single_language_is_forced_and_canonicalized() {+ // The user's one pick is forced, and the raw settings string is+ // normalized to an ISO code regardless of whether it was a name or code.+ assert_eq!(+ single_language_code(&langs(&["spanish"])),+ Some("es".to_string())+ );+ assert_eq!(+ single_language_code(&langs(&["es"])),+ Some("es".to_string())+ );+ assert_eq!(+ single_language_code(&langs(&["default", "portuguese"])),+ Some("pt".to_string())+ );+ }++ #[test]+ fn multiple_languages_mean_multilingual() {+ // Deepgram streaming has no per-stream allow-list, so 2+ picks fall+ // back to multilingual rather than arbitrarily forcing the first.+ assert_eq!(single_language_code(&langs(&["spanish", "portuguese"])), None);+ }++ #[test]+ fn unparseable_language_means_multilingual() {+ assert_eq!(single_language_code(&langs(&["klingon"])), None);+ }}