From 66a18b533fe563e6bcb60f79647e57982c3562b5 Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Tue, 24 Mar 2026 13:40:57 +0100
Subject: [PATCH] fix: reflect voice transcript into image caption via voiceMessageId
---
lib/screens/chat_screen.dart | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart
index 32f5ea5..ef7b06d 100644
--- a/lib/screens/chat_screen.dart
+++ b/lib/screens/chat_screen.dart
@@ -1017,25 +1017,31 @@
<String, dynamic>{'data': b64, 'mimeType': 'image/jpeg'}
).toList();
+ // Create the first image message early so we have its ID for transcript reflection
+ final firstImageMsg = Message.image(
+ role: MessageRole.user,
+ imageBase64: encodedImages[0],
+ content: textCaption.isNotEmpty ? textCaption : (voiceB64 != null ? '🎤 ...' : ''),
+ status: MessageStatus.sent,
+ );
+
// Send everything as a single atomic bundle
_ws?.send({
'type': 'bundle',
'caption': textCaption,
if (voiceB64 != null) 'audioBase64': voiceB64,
+ if (voiceB64 != null) 'voiceMessageId': firstImageMsg.id,
'attachments': attachments,
'sessionId': targetSessionId,
});
- // 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)
- : '';
+ // Show as combined image+caption bubbles
+ ref.read(messagesProvider.notifier).addMessage(firstImageMsg);
+ for (var i = 1; i < encodedImages.length; i++) {
final message = Message.image(
role: MessageRole.user,
imageBase64: encodedImages[i],
- content: captionText,
+ content: '',
status: MessageStatus.sent,
);
ref.read(messagesProvider.notifier).addMessage(message);
--
Gitblit v1.3.1