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(conversations): attach voice note part when sending recordings
Steven Enamakel31412d9186ab
diff --git a/app/src/features/conversations/Conversations.tsx b/app/src/features/conversations/Conversations.tsxindex aa81e0b789..f6ce0c54c8 100644--- a/app/src/features/conversations/Conversations.tsx+++ b/app/src/features/conversations/Conversations.tsx@@ -38,6 +38,7 @@ import type { VoiceNoteDraft } from '../../features/voiceNotes/useVoiceNoteRecorimport {storeVoiceNote,transcribeVoiceNote,+ voiceNoteContentPart,VOICE_NOTE_SOURCE,type VoiceNoteMeta,} from '../../features/voiceNotes/voiceNoteApi';@@ -67,6 +68,7 @@ import {editMessage,useRustChat,} from '../../services/chatService';+import type { ContentPart } from '../../services/chatWire';import { callCoreRpc } from '../../services/coreRpcClient';import type { RootState } from '../../store';import {@@ -1253,7 +1255,10 @@ const Conversations = ({return run;};- const handleSendMessage = async (text?: string, opts?: { voiceNote?: VoiceNoteMeta }) => {+ const handleSendMessage = async (+ text?: string,+ opts?: { voiceNote?: VoiceNoteMeta; voicePart?: ContentPart }+ ) => {// Guard double-submit to the SAME thread only; a send to another thread// may proceed concurrently.if (selectedThreadId && pendingSendsRef.current.has(selectedThreadId)) return;@@ -1431,6 +1436,11 @@ const Conversations = ({await chatSend({threadId: sendingThreadId,message: messageText,+ ...(opts?.voicePart+ ? { attachments: [...attachmentParts, opts.voicePart] }+ : attachmentParts.length+ ? { attachments: attachmentParts }+ : {}),...(modelOverride !== undefined ? { model: modelOverride } : {}),locale: uiLocale,reasoningEffort: composerReasoningEffort,@@ -1502,8 +1512,10 @@ const Conversations = ({if (!transcript) throw new Error(t('voiceNote.transcribeFailed'));const noteId = `vn_${globalThis.crypto.randomUUID().replace(/-/g, '')}`;const { mime } = await storeVoiceNote(noteId, draft.blob);+ const voicePart = await voiceNoteContentPart(draft.blob, draft.durationMs, draft.waveform);await handleSendMessage(transcript, {voiceNote: { noteId, mime, durationMs: draft.durationMs, waveform: draft.waveform },+ voicePart,});};diff --git a/app/src/features/voiceNotes/voiceNoteApi.test.ts b/app/src/features/voiceNotes/voiceNoteApi.test.tsindex cb92245840..bfec13cba3 100644--- a/app/src/features/voiceNotes/voiceNoteApi.test.ts+++ b/app/src/features/voiceNotes/voiceNoteApi.test.ts@@ -9,6 +9,7 @@ import {readVoiceNoteMeta,storeVoiceNote,transcribeVoiceNote,+ voiceNoteContentPart,} from './voiceNoteApi';const rpc = vi.hoisted(() => ({ callCoreRpc: vi.fn() }));@@ -22,6 +23,32 @@ describe('voiceNoteApi', () => {voice.openhumanVoiceTranscribeBytes.mockReset();});+ it('keeps a recording as a typed voice-note part with its media and duration', async () => {+ const part = await voiceNoteContentPart(+ new Blob([new Uint8Array([0, 1, 2])], { type: 'audio/wav' }),+ 5000,+ [0.2, 0.8]+ );++ expect(part).toEqual({+ kind: 'voice_note',+ voiceNote: {+ codec: 'audio/wav',+ durationMs: 5000,+ waveform: [0.2, 0.8],+ pushToTalk: false,+ media: {+ url: 'data:audio/wav;base64,AAEC',+ kind: 'audio',+ contentType: 'audio/wav',+ codec: 'audio/wav',+ durationMs: 5000,+ sizeBytes: 3,+ },+ },+ });+ });+it('round-trips bytes through base64, including large buffers', () => {const bytes = new Uint8Array(70000).map((_, i) => i % 251);expect(base64ToBytes(bytesToBase64(bytes))).toEqual(bytes);