From 780b013d20135df02c744c90cb9b0fc903c1a6c6 Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Tue, 24 Mar 2026 13:37:20 +0100
Subject: [PATCH] fix: combine voice+image into single bubble, no separate voice message
---
lib/screens/chat_screen.dart | 21 ++++++---------------
1 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart
index f6d7dd5..32f5ea5 100644
--- a/lib/screens/chat_screen.dart
+++ b/lib/screens/chat_screen.dart
@@ -1017,34 +1017,25 @@
<String, dynamic>{'data': b64, 'mimeType': 'image/jpeg'}
).toList();
- // Create voice bubble first to get messageId for transcript reflection
- String? voiceMessageId;
- if (voiceB64 != null) {
- final voiceMsg = Message.voice(
- role: MessageRole.user,
- audioUri: caption.substring('__voice__:'.length),
- status: MessageStatus.sent,
- );
- voiceMessageId = voiceMsg.id;
- ref.read(messagesProvider.notifier).addMessage(voiceMsg);
- }
-
// Send everything as a single atomic bundle
_ws?.send({
'type': 'bundle',
'caption': textCaption,
if (voiceB64 != null) 'audioBase64': voiceB64,
- if (voiceMessageId != null) 'voiceMessageId': voiceMessageId,
'attachments': attachments,
'sessionId': targetSessionId,
});
- // Show images in chat locally
+ // Show as combined image+caption bubbles (voice caption shows as text under image)
+ final voiceLabel = voiceB64 != null ? '🎤 Voice caption' : '';
for (var i = 0; i < encodedImages.length; i++) {
+ final captionText = i == 0
+ ? (textCaption.isNotEmpty ? textCaption : voiceLabel)
+ : '';
final message = Message.image(
role: MessageRole.user,
imageBase64: encodedImages[i],
- content: i == 0 ? textCaption : '',
+ content: captionText,
status: MessageStatus.sent,
);
ref.read(messagesProvider.notifier).addMessage(message);
--
Gitblit v1.3.1