Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(web_chat): flatten nested viseme metadata condition

Steven Enamakel62ed78023bd4
diff --git a/crates/openhuman-core/src/web_chat/voice_notes.rs b/crates/openhuman-core/src/web_chat/voice_notes.rs
index d5bc6a880a..b6e8b4ec0a 100644
--- a/crates/openhuman-core/src/web_chat/voice_notes.rs
+++ b/crates/openhuman-core/src/web_chat/voice_notes.rs
@@ -141,10 +141,12 @@ pub(crate) fn reply_note_metadata(workspace: &Path, request_id: &str) -> Option<
let mut metadata = json!({ "noteId": id, "mime": mime });
let viseme_path = root.join(format!("{id}.visemes.json"));
if let Ok(bytes) = std::fs::read(viseme_path) {
- if let Ok(frames) = serde_json::from_slice::<Vec<tinyinference_voice::VisemeFrame>>(&bytes)
- && !frames.is_empty()
+ if let Ok(frames) =
+ serde_json::from_slice::<Vec<tinyinference_voice::VisemeFrame>>(&bytes)
{
- metadata["visemes"] = json!(frames);
+ if !frames.is_empty() {
+ metadata["visemes"] = json!(frames);
+ }
}
}
Some(metadata)