From dbeac25149b52a6a069ad29dd75204c8953b365c Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sat, 20 Jun 2026 20:11:52 +0800 Subject: feat: add pinyin conversion for Chinese output --- src/main.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index fabf16c..e3a5b84 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,7 +31,7 @@ impl OutputChannel { } } - async fn send(&self, message: &str) { + async fn send_to_channel(&self, message: &str) { match self { OutputChannel::Stdout(p) => p.clone().send(message).await, OutputChannel::Stderr(p) => p.clone().send(message).await, @@ -252,17 +252,19 @@ async fn main() { match rx.recv().await { Ok(event) => match event { vtx_engine::EngineEvent::TranscriptionComplete(result) => { - let formatted = format_output(&pattern, &result.text, 0.0, last_volume_db); + let raw = maybe_to_pinyin(&result.text, args.use_pinyin); + let formatted = format_output(&pattern, &raw, 0.0, last_volume_db); for ch in &channels { - ch.send(&formatted).await; + ch.send_to_channel(&formatted).await; } } vtx_engine::EngineEvent::TranscriptionSegment(segment) => { - let formatted = format_output(&pattern, &segment.text, 0.0, last_volume_db); + let raw = maybe_to_pinyin(&segment.text, args.use_pinyin); + let formatted = format_output(&pattern, &raw, 0.0, last_volume_db); for ch in &channels { - ch.send(&formatted).await; + ch.send_to_channel(&formatted).await; } } vtx_engine::EngineEvent::VisualizationData(viz) => { -- cgit