The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(voiceNotes): stage recorded audio as a typed content part
Steven Enamakeled2322603e3d
diff --git a/app/src/features/voiceNotes/voiceNoteApi.ts b/app/src/features/voiceNotes/voiceNoteApi.tsindex f0c5654225..2639b201da 100644--- a/app/src/features/voiceNotes/voiceNoteApi.ts+++ b/app/src/features/voiceNotes/voiceNoteApi.ts@@ -7,6 +7,7 @@* store, so one reader serves both directions.*/import { callCoreRpc } from '../../services/coreRpcClient';+import type { ContentPart } from '../../services/chatWire';import { openhumanVoiceTranscribeBytes } from '../../utils/tauriCommands/voice';/** `extraMetadata.voiceNote` as persisted on a thread row. */@@ -47,6 +48,33 @@ export function bytesToBase64(bytes: Uint8Array): string {return btoa(binary);}+/** Keep the recorded media on the typed web-chat wire beside its transcript. */+export async function voiceNoteContentPart(+ blob: Blob,+ durationMs: number,+ waveform: number[]+): Promise<ContentPart> {+ const bytes = new Uint8Array(await blob.arrayBuffer());+ const mime = blob.type || 'audio/webm';+ return {+ kind: 'voice_note',+ voiceNote: {+ codec: mime,+ durationMs,+ waveform,+ pushToTalk: false,+ media: {+ url: `data:${mime};base64,${bytesToBase64(bytes)}`,+ kind: 'audio',+ contentType: mime,+ codec: mime,+ durationMs,+ sizeBytes: bytes.length,+ },+ },+ };+}+export function base64ToBytes(b64: string): Uint8Array {const binary = atob(b64);const out = new Uint8Array(binary.length);diff --git a/crates/openhuman-core/src/agent/attachments/parts_tests.rs b/crates/openhuman-core/src/agent/attachments/parts_tests.rsindex e4ab7b8e24..f65676e45a 100644--- a/crates/openhuman-core/src/agent/attachments/parts_tests.rs+++ b/crates/openhuman-core/src/agent/attachments/parts_tests.rs@@ -73,6 +73,21 @@ fn video_and_audio_ride_the_file_marker() {);}+#[test]+fn typed_voice_notes_are_staged_as_their_audio_media() {+ let part = ContentPart::VoiceNote {+ voice_note: tinychannels_bus::VoiceNote {+ media: media("data:audio/wav;base64,AAA"),+ duration_ms: Some(5000),+ ..Default::default()+ },+ };+ assert_eq!(+ fold_into_message("heard words", &[part]).unwrap(),+ "heard words [FILE:data:audio/wav;base64,AAA]"+ );+}+#[test]fn text_parts_join_the_message_before_markers() {let parts = [