From fc05e695fa78f19c6b03613950a078e07db8991d Mon Sep 17 00:00:00 2001 From: Logan King Date: Sat, 19 Jul 2025 18:55:29 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=85=20(assistant=5Fv2):=20skip=20LLM?= =?UTF-8?q?=20on=20empty=20transcription?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assistant_v2/FEATURE_PROGRESS.md | 1 + assistant_v2/src/main.rs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/assistant_v2/FEATURE_PROGRESS.md b/assistant_v2/FEATURE_PROGRESS.md index 0ba14fb..ce12f13 100644 --- a/assistant_v2/FEATURE_PROGRESS.md +++ b/assistant_v2/FEATURE_PROGRESS.md @@ -21,5 +21,6 @@ This document tracks which features from the original assistant have been implem | Push-to-talk text-to-speech interface | Done | | Interrupt AI speech with push-to-talk | Done | | Log function invocation names | Done | +| Handle empty transcription results | Done | Update this table as features are migrated and verified to work in `assistant_v2`. diff --git a/assistant_v2/src/main.rs b/assistant_v2/src/main.rs index 18aca41..4b280bf 100644 --- a/assistant_v2/src/main.rs +++ b/assistant_v2/src/main.rs @@ -21,6 +21,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Mutex}; use std::time::Instant; use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter}; +use tracing::info; mod record; mod transcribe; @@ -334,6 +335,11 @@ async fn main() -> Result<(), Box> { let audio_path = audio_rx.recv().unwrap(); interrupt_flag.store(false, Ordering::SeqCst); let transcription = transcribe::transcribe(&client, &audio_path).await?; + if transcription.trim().is_empty() { + println!("No transcription"); + info!("User transcription was empty. Aborting LLM response."); + continue; + } println!("{}", "You: ".truecolor(0, 255, 0)); println!("{}", transcription);