Skip to content

Commit

Permalink
fix: do not add empty transcriptions to db
Browse files Browse the repository at this point in the history
  • Loading branch information
louis030195 committed Aug 1, 2024
1 parent 59d274a commit 70039a9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
name: Release App

on:
# push:
# tags:
# - "v*"
push:
tags:
- "v*"
workflow_dispatch:

jobs:
Expand Down
Binary file added output_0.mp4
Binary file not shown.
1 change: 1 addition & 0 deletions screenpipe-audio/src/stt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ fn get_deepgram_api_key() -> String {
"7ed2a159a094337b01fd8178b914b7ae0e77822d".to_string()
}

// TODO: this should use async reqwest not blocking, cause crash issue because all our code is async
fn transcribe_with_deepgram(api_key: &str, audio_data: &[f32]) -> Result<String> {
debug!("Starting Deepgram transcription");
let client = Client::new();
Expand Down
10 changes: 7 additions & 3 deletions screenpipe-server/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ async fn record_audio(
.to_str()
.expect("Failed to create valid path")
.to_string();
debug!(
debug!(
"Starting record_and_transcribe for device {} (iteration {})",
audio_device_clone, iteration
);
Expand Down Expand Up @@ -297,8 +297,12 @@ async fn process_audio_result(db: &DatabaseManager, result: TranscriptionResult)
);
return;
}
info!("Inserting audio chunk: {:?}", result.transcription);
let transcription = result.transcription.unwrap();
// if audio text is empty skip, add debug log
if transcription.is_empty() {
return;
}
info!("Inserting audio chunk: {:?}", transcription);
match db.insert_audio_chunk(&result.input.path).await {
Ok(audio_chunk_id) => {
if let Err(e) = db
Expand All @@ -321,4 +325,4 @@ async fn process_audio_result(db: &DatabaseManager, result: TranscriptionResult)
result.input.device, e
),
}
}
}

0 comments on commit 70039a9

Please sign in to comment.