fix: Sprachnachricht-Bubble defensiv + Bild+Text als eine Anfrage

Bug 2: STT-Result schreibt jetzt eine neue User-Bubble wenn keine
Placeholder im State gefunden wird (statt das Update zu verwerfen).
Schuetzt vor Race-Conditions zwischen audio-send und State-Updates,
damit der gesprochene Text immer im Chat erscheint.

Bug 3: Bild + Text wurden als zwei getrennte Events ('file' + 'chat')
gesendet, jeder triggerte einen eigenen send_to_core. ARIA antwortete
zweimal — einmal "warte auf Anweisung" beim Bild, dann nochmal auf
den Text. Bridge buffert jetzt eingehende file-Events 800ms; kommt in
dem Fenster ein chat, werden alle Files + Text zu einer einzigen
aria-core-Nachricht gemerged. Kein chat → Files alleine wie bisher.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-03 21:40:15 +02:00
parent 8761d1a1b7
commit 20123de827
2 changed files with 110 additions and 52 deletions
+15 -2
View File
@@ -281,9 +281,22 @@ const ChatScreen: React.FC = () => {
const idx = prev.findIndex(m =>
m.sender === 'user' && m.text.includes('Spracheingabe wird verarbeitet')
);
if (idx < 0) return prev;
const newText = `\uD83C\uDFA4 ${sttText}`;
if (idx < 0) {
// Defensiv: wenn keine Placeholder im State (z.B. weil sie nie
// hinzugefuegt wurde oder schon durch ein anderes Update verloren
// ging), die Sprachnachricht trotzdem als neue Bubble einfuegen.
// Sonst kommt ARIAs Antwort ohne sichtbare User-Nachricht.
return capMessages([...prev, {
id: nextId(),
sender: 'user',
text: newText,
timestamp: message.timestamp,
attachments: [{ type: 'audio', name: 'Sprachaufnahme' }],
}]);
}
const next = prev.slice();
next[idx] = { ...next[idx], text: `\uD83C\uDFA4 ${sttText}` };
next[idx] = { ...next[idx], text: newText };
return next;
});
}